本文整理汇总了Python中mozdevice.DeviceManagerADB.reboot方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.reboot方法的具体用法?Python DeviceManagerADB.reboot怎么用?Python DeviceManagerADB.reboot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozdevice.DeviceManagerADB
的用法示例。
在下文中一共展示了DeviceManagerADB.reboot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import reboot [as 别名]
def tearDown(self):
dm = DeviceManagerADB()
dm.reboot()
示例2: setUp
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import reboot [as 别名]
def setUp(self):
dm = DeviceManagerADB()
dm.reboot(wait=True)
示例3: test_after_reboot_adb_runs_as_root
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import reboot [as 别名]
def test_after_reboot_adb_runs_as_root(self):
dm = DeviceManagerADB(runAdbAsRoot=True)
self.assertTrue(dm.processInfo("adbd")[2] == "root")
dm.reboot(wait=True)
self.assertTrue(dm.processInfo("adbd")[2] == "root")
示例4: TestRun
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import reboot [as 别名]
class TestRun(object):
def __init__(self, adb="adb", serial=None):
self.test_results = {}
self.test_results_file = None
self.m = None
self.gaia_apps = None
self.screenshot_path = None
self.logcat_path = None
self.app_name = None
self.attempt = None
self.num_apps = None
self.device = None
self.serial = serial
self.port = None
self.run_log = logging.getLogger('marketplace-test')
if self.serial:
self.dm = DeviceManagerADB(adbPath=adb, deviceSerial=serial)
else:
self.dm = DeviceManagerADB(adbPath=adb)
def reset_marionette(self):
try:
self.m.delete_session()
except Exception:
pass
self.m = None
self.get_marionette()
def get_marionette(self):
if not self.m:
self.m = Marionette(port=self.port)
self.m.start_session()
self.device = GaiaDevice(self.m)
self.device.add_device_manager(self.dm)
self.gaia_apps = GaiaApps(self.m)
else:
tries = 5
while tries > 0:
try:
self.m.get_url()
break
except MarionetteException as e:
if "Please start a session" in str(e):
time.sleep(5)
self.m = Marionette(port=self.port)
self.m.start_session()
self.device = GaiaDevice(self.m)
self.device.add_device_manager(self.dm)
self.gaia_apps = GaiaApps(self.m)
tries -= 1
else:
raise e
else:
self.run_log.error("Can't connect to marionette, rebooting")
self.restart_device()
return self.m
def write_to_file(self, data):
with open("%s.tmp" % self.test_results_file, "w") as f:
f.write(data)
shutil.copyfile("%s.tmp" % self.test_results_file, self.test_results_file)
def add_values(self, key, value):
if self.serial:
self.test_results["%s_%s" % (key, self.serial)] = value
else:
self.test_results["%s" % key] = value
def add_result(self, passed=False, status=None, uninstalled_failure=False):
values = {}
if status:
if not passed:
values["status"] = "FAILED: %s" % status
else:
values["status"] = "PASS"
if self.screenshot_path:
values["screenshot"] = self.screenshot_path
if self.logcat_path:
values["logcat"] = self.logcat_path
if uninstalled_failure:
values["uninstalled_failure"] = uninstalled_failure
entry = "%s_%s" % (self.app_name, self.attempt)
self.test_results[entry] = values
def launch_with_manifest(self, manifest):
self.m.switch_to_frame()
result = self.m.execute_async_script("GaiaApps.launchWithManifestURL('%s')" % manifest, script_timeout=30000)
if result == False:
raise Exception("launch timed out")
app = GaiaApp(frame=result.get('frame'),
src=result.get('src'),
name=result.get('name'),
origin=result.get('origin'))
if app.frame_id is None:
raise Exception("failed to launch; there is no app frame")
self.m.switch_to_frame(app.frame_id)
return app
def uninstall_with_manifest(self, manifest):
#.........这里部分代码省略.........