本文整理汇总了Python中mozdevice.DeviceManagerADB.removeFile方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.removeFile方法的具体用法?Python DeviceManagerADB.removeFile怎么用?Python DeviceManagerADB.removeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozdevice.DeviceManagerADB
的用法示例。
在下文中一共展示了DeviceManagerADB.removeFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DeviceManagerADBTestCase
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import removeFile [as 别名]
class DeviceManagerADBTestCase(unittest.TestCase):
tempLocalDir = "tempDir"
tempLocalFile = os.path.join(tempLocalDir, "tempfile.txt")
tempRemoteDir = None
tempRemoteFile = None
tempRemoteSystemFile = None
def setUp(self):
self.assertTrue(find_mount_permissions(self.dm, "/system"), "ro")
self.assertTrue(os.path.exists(self.tempLocalDir))
self.assertTrue(os.path.exists(self.tempLocalFile))
if self.dm.fileExists(self.tempRemoteFile):
self.dm.removeFile(self.tempRemoteFile)
self.assertFalse(self.dm.fileExists(self.tempRemoteFile))
if self.dm.fileExists(self.tempRemoteSystemFile):
self.dm.removeFile(self.tempRemoteSystemFile)
self.assertTrue(self.dm.dirExists(self.tempRemoteDir))
@classmethod
def setUpClass(self):
self.dm = DeviceManagerADB()
if not os.path.exists(self.tempLocalDir):
os.mkdir(self.tempLocalDir)
if not os.path.exists(self.tempLocalFile):
# Create empty file
open(self.tempLocalFile, 'w').close()
self.tempRemoteDir = self.dm.getTempDir()
self.tempRemoteFile = os.path.join(self.tempRemoteDir,
os.path.basename(self.tempLocalFile))
self.tempRemoteSystemFile = \
os.path.join("/system", os.path.basename(self.tempLocalFile))
@classmethod
def tearDownClass(self):
os.remove(self.tempLocalFile)
os.rmdir(self.tempLocalDir)
if self.dm.dirExists(self.tempRemoteDir):
# self.tempRemoteFile will get deleted with it
self.dm.removeDir(self.tempRemoteDir)
if self.dm.fileExists(self.tempRemoteSystemFile):
self.dm.removeFile(self.tempRemoteSystemFile)
示例2: __init__
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import removeFile [as 别名]
class ADBFuzz:
def __init__(self, cfgFile):
self.config = ADBFuzzConfig(cfgFile)
self.HTTPProcess = None
self.logProcesses = []
self.logThreads = []
self.remoteInitialized = None
self.triager = Triager(self.config)
# Seed RNG with localtime
random.seed()
def deploy(self, packageFile, prefFile):
self.dm = DeviceManagerADB(self.config.remoteAddr, 5555)
# Install a signal handler that shuts down our external programs on SIGINT
signal.signal(signal.SIGINT, self.signal_handler)
self.dm.updateApp(packageFile)
# Standard init stuff
self.appName = self.dm.packageName
self.appRoot = self.dm.getAppRoot(self.appName)
self.profileBase = self.appRoot + "/files/mozilla"
# Ensure no Fennec instance is running
self.stopFennec()
# Start Fennec, so a profile is created if this is the first install
self.startFennec(blank=True)
# Grant some time to create profile
time.sleep(self.config.runTimeout * 2)
# Stop Fennec again
self.stopFennec()
# Now try to get the profile(s)
self.profiles = self.getProfiles()
if (len(self.profiles) == 0):
print "Failed to detect any valid profile, aborting..."
return 1
self.defaultProfile = self.profiles[0]
if (len(self.profiles) > 1):
print "Multiple profiles detected, using the first: " + self.defaultProfile
# Push prefs.js to profile
self.dm.pushFile(prefFile, self.profileBase + "/" + self.defaultProfile + "/prefs.js")
# Try to install addon if requested by configuration
if self.config.addon != None:
self.ensureExtensionInstalled(self.config.addon)
print "Successfully deployed package."
def reset(self, prefFile):
self.dm = DeviceManagerADB(self.config.remoteAddr, 5555)
# Install a signal handler that shuts down our external programs on SIGINT
signal.signal(signal.SIGINT, self.signal_handler)
# Standard init stuff
self.appName = self.dm.packageName
self.appRoot = self.dm.getAppRoot(self.appName)
self.profileBase = self.appRoot + "/files/mozilla"
# Ensure no Fennec instance is running
self.stopFennec()
# Now try to get the old profile(s)
self.profiles = self.getProfiles()
for profile in self.profiles:
self.dm.removeDir(self.profileBase + "/" + profile)
self.dm.removeFile(self.profileBase + "/profiles.ini")
# Start Fennec, so a new profile is created
self.startFennec(blank=True)
# Grant some time to create profile
time.sleep(self.config.runTimeout * 2)
# Stop Fennec again
self.stopFennec()
# Now try to get the profile(s) again
self.profiles = self.getProfiles()
if (len(self.profiles) == 0):
print "Failed to detect any valid profile, aborting..."
return 1
self.defaultProfile = self.profiles[0]
#.........这里部分代码省略.........