本文整理汇总了Python中mozdevice.DeviceManagerADB.getAppRoot方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.getAppRoot方法的具体用法?Python DeviceManagerADB.getAppRoot怎么用?Python DeviceManagerADB.getAppRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozdevice.DeviceManagerADB
的用法示例。
在下文中一共展示了DeviceManagerADB.getAppRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import getAppRoot [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]
#.........这里部分代码省略.........