diff --git a/mcts/certsuite/cert.py b/mcts/certsuite/cert.py index 6f399305..434f1d16 100755 --- a/mcts/certsuite/cert.py +++ b/mcts/certsuite/cert.py @@ -50,6 +50,8 @@ last_test_started = 'None' logger = None +expected_results_path = '../static/expected_results' + # supported_versions = ["2.2", "2.1", "2.0", "1.4", "1.3"] expected_result_folder = os.path.join('..', 'static', 'expected_results') @@ -96,9 +98,8 @@ def webapi_log_handler(request, response): ("POST", "/webapi_log", webapi_log_handler), ("GET", "/*", wptserve.handlers.file_handler)] -static_path = os.path.abspath(os.path.join( - os.path.dirname(__file__), "static")) - +mcts_current_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) +static_path = os.path.join(mcts_current_path, "static") def read_manifest(app): with open(os.path.join(app, 'manifest.webapp')) as f: @@ -174,7 +175,8 @@ def test_webapi(logger, report, args, addr): webapi_results = None appname = '%s WebAPI Verifier' % apptype.capitalize() - apppath = os.path.join(static_path, 'webapi-test-app') + sampleapppath = os.path.join(static_path, 'sample_apps') + apppath = os.path.join(sampleapppath, 'webapi-test-app') install_app(logger, appname, args.version, apptype, apppath, True, {'results_uri.js': 'RESULTS_URI="http://%s:%s/webapi_results";LOG_URI="http://%s:%s/webapi_log";' % (addr * 2)}, @@ -252,14 +254,16 @@ def test_permissions(logger, report, args, addr): # first install test app for embed-apps permission test embed_appname = 'Embed Apps Test App' - apppath = os.path.join(static_path, 'embed-apps-test-app') + sampleapppath = os.path.join(static_path, 'sample_apps') + apppath = os.path.join(sampleapppath, 'embed-apps-test-app') install_app(logger, embed_appname, args.version, 'certified', apppath, True, {'results_uri.js': 'RESULTS_URI="http://%s:%s/webapi_results_embed_apps";' % addr}, False) appname = 'Permissions Test App' installed_appname = appname.lower().replace(" ", "-") - apppath = os.path.join(static_path, 'permissions-test-app') + sampleapppath = os.path.join(static_path, 'sample_apps') + apppath = os.path.join(sampleapppath, 'permissions-test-app') install_app(logger, appname, args.version, 'web', apppath, False, {'results_uri.js': 'RESULTS_URI="http://%s:%s/webapi_results";LOG_URI="http://%s:%s/webapi_log";' % (addr * 2)}) @@ -396,7 +400,8 @@ def test_open_remote_window(logger, version, addr): appname = 'Open Remote Window Test App' installed_appname = appname.lower().replace(" ", "-") - apppath = os.path.join(static_path, 'open-remote-window-test-app') + sampleapppath = os.path.join(static_path, 'sample_apps') + apppath = os.path.join(sampleapppath, 'open-remote-window-test-app') install_app(logger, appname, version, 'web', apppath, False, {'results_uri.js': 'RESULTS_URI="http://%s:%s/webapi_results";' % addr}) @@ -602,10 +607,14 @@ def tabelize(value): def get_application_ini(dm): # application.ini information - appinicontents = dm.pullFile('/system/b2g/application.ini') - sf = StringIO.StringIO(appinicontents) - config = ConfigParser.ConfigParser() - config.readfp(sf) + #appinicontents = dm.pullFile('/system/b2g/application.ini') + #sf = StringIO.StringIO(appinicontents) + #config = ConfigParser.ConfigParser() + #config.readfp(sf) + ini_file = '_app.ini' + dm.pull('/system/b2g/application.ini', ini_file) + config = ConfigParser.RawConfigParser() + config.read(ini_file) application_ini = {} for section in config.sections(): application_ini[section] = dict(config.items(section)) @@ -615,7 +624,7 @@ def get_application_ini(dm): def get_buildprop(dm): # get build properties buildprops = {} - buildpropoutput = dm.shellCheckOutput(["cat", "/system/build.prop"]) + buildpropoutput = dm.shell_output("cat /system/build.prop") for buildprop in [line for line in buildpropoutput.splitlines() if '=' \ in line]: eq = buildprop.find('=') @@ -626,11 +635,11 @@ def get_buildprop(dm): def get_processes_running(dm): - return map(lambda p: {'name': p[1], 'user': p[2]}, dm.getProcessList()) + return map(lambda p: {'name': p[1], 'user': p[2]}, dm.get_process_list()) def get_kernel_version(dm): - return dm.shellCheckOutput(["cat", "/proc/version"]) + return dm.shell_output("cat /proc/version") def _run(args, logger): diff --git a/mcts/config.json b/mcts/config.json index 0f0ceca8..36db0871 100644 --- a/mcts/config.json +++ b/mcts/config.json @@ -9,9 +9,6 @@ "%(temp_dir)s/omni_diff_report.html"]}], ["webapi", {"cmd": "webapirunner", "run_args": ["--version=%(version)s"]}], - ["web-platform-tests", {"cmd": "wptrunner", - "common_args": ["--include-manifest=mcts/web-platform-tests/include.ini", "--config=mcts/web-platform-tests/wptrunner.ini"], - "run_args": ["--product=b2g", "--test-type=testharness", "--b2g-no-backup"]}], ["security", {"cmd": "securityrunner", "run_args":["--version=%(version)s"]}] ] } diff --git a/mcts/config.json.bak b/mcts/config.json.bak new file mode 100644 index 00000000..0f0ceca8 --- /dev/null +++ b/mcts/config.json.bak @@ -0,0 +1,17 @@ +{"version": "2.2", + "suites": [ + ["cert", {"cmd": "cert", + "run_args": ["--version=%(version)s", + "--result-file=%(temp_dir)s/cert_results.json", + "--html-result-file=%(temp_dir)s/cert_results.html"], + "extra_files": ["%(temp_dir)s/cert_results.json", + "%(temp_dir)s/cert_results.html", + "%(temp_dir)s/omni_diff_report.html"]}], + ["webapi", {"cmd": "webapirunner", + "run_args": ["--version=%(version)s"]}], + ["web-platform-tests", {"cmd": "wptrunner", + "common_args": ["--include-manifest=mcts/web-platform-tests/include.ini", "--config=mcts/web-platform-tests/wptrunner.ini"], + "run_args": ["--product=b2g", "--test-type=testharness", "--b2g-no-backup"]}], + ["security", {"cmd": "securityrunner", "run_args":["--version=%(version)s"]}] + ] +} diff --git a/mcts/harness.py b/mcts/harness.py index f866e214..3d959714 100644 --- a/mcts/harness.py +++ b/mcts/harness.py @@ -385,6 +385,8 @@ def restart(self): pass def root(self): pass + def devices(self, timeout=None): + pass def check_adb(): try: diff --git a/mcts/securitysuite/filesystem.py b/mcts/securitysuite/filesystem.py index 047baaeb..f944a081 100644 --- a/mcts/securitysuite/filesystem.py +++ b/mcts/securitysuite/filesystem.py @@ -13,6 +13,7 @@ # getter for shared logger instance from mozlog.structured import get_default_logger from mcts.utils.device.devicehelper import DeviceHelper +from mozdevice.adb import ADBError # ###################################################################################################################### @@ -45,8 +46,8 @@ def parse_ls(out): # adb returns newline as \r\n # but mozdevice uses \n - for dirstr in out[2:-2].split('\n\n'): - lines = dirstr.split('\n') + for dirstr in out[2:-2].split('\r\n\r\n'): + lines = dirstr.split('\r\n') dirname = lines[0][:-1] if len(lines) == 2 and lines[1].startswith("opendir failed"): continue @@ -176,16 +177,16 @@ def run(cls, version=None): logger = get_default_logger() try: - dm = DeviceHelper.getDevice(runAdbAsRoot=True) - except mozdevice.DMError as e: + device = DeviceHelper.getDevice() + except ADBError as e: logger.error("Error connecting to device via adb (error: %s). Please be " \ "sure device is connected and 'remote debugging' is enabled." % \ e.msg) raise try: - out = dm.shellCheckOutput(['ls', '-alR', '/'], root=True) - except mozdevice.DMError as e: + out = device.shell_output('ls -alR /', root=True) + except ADBError as e: cls.log_status('FAIL', 'Failed to gather filesystem information from device via adb: %s' % e.msg) return False @@ -236,16 +237,16 @@ def run(cls, version=None): logger = get_default_logger() try: - dm = DeviceHelper.getDevice(runAdbAsRoot=True) - except mozdevice.DMError as e: + device = DeviceHelper.getDevice() + except ADBError as e: logger.error("Error connecting to device via adb (error: %s). Please be " \ "sure device is connected and 'remote debugging' is enabled." % \ e.msg) raise try: - out = dm.shellCheckOutput(['ls', '-alR', '/'], root=True) - except mozdevice.DMError as e: + out = device.shell_output('ls -alR /', root=True) + except ADBError as e: cls.log_status('FAIL', 'Failed to gather filesystem information from device via adb: %s' % e.msg) return False diff --git a/mcts/securitysuite/kernel.py b/mcts/securitysuite/kernel.py index b6b57ea4..8d01ba80 100644 --- a/mcts/securitysuite/kernel.py +++ b/mcts/securitysuite/kernel.py @@ -11,6 +11,7 @@ from mozlog.structured import get_default_logger from mcts.utils.device.devicehelper import DeviceHelper +from mozdevice.adb import ADBError # ###################################################################################################################### # shared module functions @@ -44,16 +45,16 @@ class b2gps(object): def __init__(self): self.logger = get_default_logger() try: - self.dm = DeviceHelper.getDevice() - except mozdevice.DMError as e: + self.device = DeviceHelper.getDevice() + except ADBError as e: self.logger.error("Error connecting to device via adb (error: %s). Please be " "sure device is connected and 'remote debugging' is enabled." % e.msg) raise try: - self.ps = self.dm.shellCheckOutput(['b2g-ps'], root=True).split('\n') - except mozdevice.DMError as e: + self.ps = self.device.shell_output('b2g-ps', root=True).split('\r\n') + except ADBError as e: self.logger.error("Error reading b2g-ps result from device: %s" % e.msg) raise @@ -83,16 +84,16 @@ class procpid(object): def __init__(self): self.logger = get_default_logger() try: - self.dm = DeviceHelper.getDevice(runAdbAsRoot) - except mozdevice.DMError as e: + self.device = DeviceHelper.getDevice() + except ADBError as e: self.logger.error("Error connecting to device via adb (error: %s). Please be " "sure device is connected and 'remote debugging' is enabled." % e.msg) raise def get_pidlist(self): - out = self.dm.shellCheckOutput(['ls', '/proc/*/status'], root=True) - proclines = out.split('\n')[-1] # skip 'self' which is always last + out = self.device.shell_output('ls /proc/*/status', root=True) + proclines = out.split('\r\n')[-1] # skip 'self' which is always last pids = [x.split('/')[2] for x in proclines] return pids diff --git a/mcts/securitysuite/suite.py b/mcts/securitysuite/suite.py index 8f24b98e..cd187148 100644 --- a/mcts/securitysuite/suite.py +++ b/mcts/securitysuite/suite.py @@ -12,6 +12,7 @@ from mozlog.structured import commandline, get_default_logger from time import sleep from mcts.utils.device.devicehelper import DeviceHelper +from mozdevice.adb import ADBError # ###################################################################################################################### # Test class that all test must be derived from @@ -77,7 +78,7 @@ def run_groups(groups=[], version=None, host='localhost', port=2828, mode='phone # setup marionette before any test marionette = DeviceHelper.getMarionette(host=host, port=port) # setup device before any test - device = DeviceHelper.getDevice(runAdbAsRoot=True) + device = DeviceHelper.getDevice() for g in groups: logger.debug("running securitysuite test group %s" % g) @@ -111,25 +112,25 @@ def log_status(cls, status, msg): def wait_for_adb_device(): try: - adb = DeviceHelper.getDevice(runAdbAsRoot=True) - except DMError: - adb = None + device = DeviceHelper.getDevice() + except ADBError: + device = None print "Waiting for adb connection..." - while adb is None: + while device is None: try: - adb = DeviceHelper.getDevice(runAdbAsRoot=True) - except DMError: + device = DeviceHelper.getDevice() + except ADBError: sleep(0.2) - if len(adb.devices()) < 1: + if len(device.devices()) < 1: print "Waiting for adb device..." - while len(adb.devices()) < 1: + while len(device.devices()) < 1: sleep(0.2) def adb_has_root(): - # normally this should check via root=True to .shellCheckOutput, but doesn't work - adb = DeviceHelper.getDevice(runAdbAsRoot=True) - return adb.shellCheckOutput(["id"]).startswith("uid=0(root)") + # normally this should check via root=True to .shell_output, but doesn't work + device = DeviceHelper.getDevice() + return device.shell_output("id").startswith("uid=0(root)") ####################################################################################################################### diff --git a/mcts/static/expected_results/expected_permissions_results/certified.json b/mcts/static/expected_results/expected_permissions_results/certified.json index bdf8e763..9ae0465b 100644 --- a/mcts/static/expected_results/expected_permissions_results/certified.json +++ b/mcts/static/expected_results/expected_permissions_results/certified.json @@ -1,81 +1,82 @@ { - "alarms": "unknown", - "attention": "unknown", - "audio-capture": "unknown", - "audio-capture:3gpp": "unknown", - "audio-channel-alarm": "unknown", - "audio-channel-content": "unknown", - "audio-channel-normal": "unknown", - "audio-channel-notification": "unknown", - "audio-channel-publicnotification": "unknown", - "audio-channel-ringer": "unknown", - "audio-channel-telephony": "unknown", - "background-sensors": "unknown", - "backgroundservice": "unknown", - "before-after-keyboard-event": "unknown", - "bluetooth": "unknown", - "browser": "unknown", - "camera": "unknown", - "cellbroadcast": "unknown", - "contacts": "unknown", - "desktop-notification": "unknown", - "device-storage:apps": "unknown", - "device-storage:crashes": "unknown", - "device-storage:music": "unknown", - "device-storage:pictures": "unknown", - "device-storage:sdcard": "unknown", - "device-storage:videos": "unknown", - "downloads": "unknown", - "embed-apps": "unknown", - "embed-widgets": "unknown", - "engineering-mode": "unknown", - "feature-detection": "unknown", - "firefox-accounts": "unknown", - "fmradio": "unknown", - "geolocation": "unknown", - "geolocation-noprompt": "unknown", - "global-clickthrough-overlay": "unknown", - "homescreen-webapps-manage": "unknown", - "idle": "unknown", - "input": "unknown", - "input-manage": "unknown", - "mobileconnection": "unknown", - "mobileid": "unknown", - "mobilenetwork": "unknown", - "moz-attention": "unknown", - "moz-audio-channel-ringer": "unknown", - "moz-audio-channel-telephony": "unknown", - "moz-firefox-accounts": "unknown", - "network-events": "unknown", - "networkstats-manage": "unknown", - "nfc": "unknown", - "nfc-hci-events": "unknown", - "nfc-manager": "unknown", - "nfc-share": "unknown", - "open-remote-window": "unknown", - "permissions": "unknown", - "phonenumberservice": "unknown", - "power": "unknown", - "push": "unknown", - "resourcestats-manage": "unknown", - "secureelement-manage": "unknown", - "settings": "unknown", - "settings-clear": "unknown", - "settings:wallpaper.image": "unknown", - "sms": "unknown", - "speaker-control": "unknown", - "storage": "unknown", - "systemXHR": "unknown", - "tcp-socket": "unknown", - "telephony": "unknown", - "test-permission": "unknown", - "themeable": "unknown", - "time": "unknown", - "tv": "unknown", - "udp-socket": "unknown", - "video-capture": "unknown", - "voicemail": "unknown", - "wappush": "unknown", - "webapps-manage": "unknown", + "alarms": "unknown", + "attention": "unknown", + "audio-capture": "unknown", + "audio-capture:3gpp": "unknown", + "audio-channel-alarm": "unknown", + "audio-channel-content": "unknown", + "audio-channel-normal": "unknown", + "audio-channel-notification": "unknown", + "audio-channel-publicnotification": "unknown", + "audio-channel-ringer": "unknown", + "audio-channel-telephony": "unknown", + "background-sensors": "unknown", + "backgroundservice": "unknown", + "before-after-keyboard-event": "unknown", + "bluetooth": "unknown", + "browser": "unknown", + "camera": "unknown", + "cellbroadcast": "unknown", + "contacts": "unknown", + "desktop-notification": "unknown", + "device-storage:apps": "unknown", + "device-storage:crashes": "unknown", + "device-storage:music": "unknown", + "device-storage:pictures": "unknown", + "device-storage:sdcard": "unknown", + "device-storage:videos": "unknown", + "downloads": "unknown", + "embed-apps": "unknown", + "embed-widgets": "unknown", + "engineering-mode": "unknown", + "external-app": "unknown", + "feature-detection": "unknown", + "firefox-accounts": "unknown", + "fmradio": "unknown", + "geolocation": "unknown", + "geolocation-noprompt": "unknown", + "global-clickthrough-overlay": "unknown", + "homescreen-webapps-manage": "unknown", + "idle": "unknown", + "input": "unknown", + "input-manage": "unknown", + "mobileconnection": "unknown", + "mobileid": "unknown", + "mobilenetwork": "unknown", + "moz-attention": "unknown", + "moz-audio-channel-ringer": "unknown", + "moz-audio-channel-telephony": "unknown", + "moz-firefox-accounts": "unknown", + "network-events": "unknown", + "networkstats-manage": "unknown", + "nfc": "unknown", + "nfc-hci-events": "unknown", + "nfc-manager": "unknown", + "nfc-share": "unknown", + "open-remote-window": "unknown", + "permissions": "unknown", + "phonenumberservice": "unknown", + "power": "unknown", + "push": "unknown", + "resourcestats-manage": "unknown", + "secureelement-manage": "unknown", + "settings": "unknown", + "settings-clear": "unknown", + "settings:wallpaper.image": "unknown", + "sms": "unknown", + "speaker-control": "unknown", + "storage": "unknown", + "systemXHR": "unknown", + "tcp-socket": "unknown", + "telephony": "unknown", + "test-permission": "unknown", + "themeable": "unknown", + "time": "unknown", + "tv": "unknown", + "udp-socket": "unknown", + "video-capture": "unknown", + "voicemail": "unknown", + "wappush": "unknown", + "webapps-manage": "unknown", "wifi-manage": "unknown" } \ No newline at end of file diff --git a/mcts/static/expected_results/expected_permissions_results/permissions.json b/mcts/static/expected_results/expected_permissions_results/permissions.json index b2c928de..355c959b 100644 --- a/mcts/static/expected_results/expected_permissions_results/permissions.json +++ b/mcts/static/expected_results/expected_permissions_results/permissions.json @@ -1,210 +1,213 @@ { "alarms": [ - "window.AlarmsManager", + "window.AlarmsManager", "window.navigator.mozAlarms" - ], - "attention": [], - "audio-capture": [], - "audio-capture:3gpp": [], - "audio-channel-alarm": [], - "audio-channel-content": [], - "audio-channel-normal": [], - "audio-channel-notification": [], - "audio-channel-publicnotification": [], - "audio-channel-ringer": [], - "audio-channel-telephony": [], - "background-sensors": [], - "backgroundservice": [], + ], + "attention": [], + "audio-capture": [], + "audio-capture:3gpp": [], + "audio-channel-alarm": [], + "audio-channel-content": [], + "audio-channel-normal": [], + "audio-channel-notification": [], + "audio-channel-publicnotification": [], + "audio-channel-ringer": [], + "audio-channel-telephony": [], + "background-sensors": [], + "backgroundservice": [], "before-after-keyboard-event": [ "window.BeforeAfterKeyboardEvent" - ], + ], "bluetooth": [ - "window.BluetoothDeviceEvent", - "window.BluetoothDevice", - "window.BluetoothDiscoveryStateChangedEvent", - "window.BluetoothAdapter", - "window.BluetoothManager", - "window.BluetoothStatusChangedEvent", + "window.BluetoothDeviceEvent", + "window.BluetoothDevice", + "window.BluetoothDiscoveryStateChangedEvent", + "window.BluetoothAdapter", + "window.BluetoothManager", + "window.BluetoothStatusChangedEvent", "window.navigator.mozBluetooth" - ], + ], "browser": [ - "browser", - "window.document.body.lastElementChild.getCanGoBack", - "window.document.body.lastElementChild.purgeHistory", - "window.document.body.lastElementChild.getCanGoForward", - "window.document.body.lastElementChild.reload", - "window.document.body.lastElementChild.goForward", - "window.document.body.lastElementChild.setInputMethodActive", - "window.document.body.lastElementChild.setActive", - "window.document.body.lastElementChild.sendTouchEvent", - "window.document.body.lastElementChild.stop", - "window.document.body.lastElementChild.zoom", - "window.document.body.lastElementChild.getVisible", - "window.document.body.lastElementChild.download", - "window.document.body.lastElementChild.removeNextPaintListener", - "window.document.body.lastElementChild.getActive", - "window.document.body.lastElementChild.getScreenshot", - "window.document.body.lastElementChild.goBack", - "window.document.body.lastElementChild.getContentDimensions", - "window.document.body.lastElementChild.addNextPaintListener", - "window.document.body.lastElementChild.sendMouseEvent", - "window.document.body.lastElementChild.setVisible", + "browser", + "window.document.body.lastElementChild.getCanGoBack", + "window.document.body.lastElementChild.purgeHistory", + "window.document.body.lastElementChild.getCanGoForward", + "window.document.body.lastElementChild.reload", + "window.document.body.lastElementChild.goForward", + "window.document.body.lastElementChild.setInputMethodActive", + "window.document.body.lastElementChild.setActive", + "window.document.body.lastElementChild.sendTouchEvent", + "window.document.body.lastElementChild.stop", + "window.document.body.lastElementChild.zoom", + "window.document.body.lastElementChild.getVisible", + "window.document.body.lastElementChild.download", + "window.document.body.lastElementChild.removeNextPaintListener", + "window.document.body.lastElementChild.getActive", + "window.document.body.lastElementChild.getScreenshot", + "window.document.body.lastElementChild.goBack", + "window.document.body.lastElementChild.getContentDimensions", + "window.document.body.lastElementChild.addNextPaintListener", + "window.document.body.lastElementChild.sendMouseEvent", + "window.document.body.lastElementChild.setVisible", "window.document.body.lastElementChild.setNFCFocus" - ], + ], "camera": [ - "window.CameraCapabilities", - "window.CameraFacesDetectedEvent", - "window.CameraConfigurationEvent", - "window.CameraControl", - "window.CameraRecorderAudioProfile", - "window.CameraDetectedFace", - "window.CameraRecorderProfile", - "window.CameraStateChangeEvent", - "window.CameraRecorderProfiles", - "window.CameraClosedEvent", - "window.CameraManager", - "window.CameraRecorderVideoProfile", + "window.CameraCapabilities", + "window.CameraFacesDetectedEvent", + "window.CameraConfigurationEvent", + "window.CameraControl", + "window.CameraRecorderAudioProfile", + "window.CameraDetectedFace", + "window.CameraRecorderProfile", + "window.CameraStateChangeEvent", + "window.CameraRecorderProfiles", + "window.CameraClosedEvent", + "window.CameraManager", + "window.CameraRecorderVideoProfile", "window.navigator.mozCameras" - ], + ], "cellbroadcast": [ "window.navigator.mozCellBroadcast" - ], - "contacts": [], - "desktop-notification": [], - "device-storage:apps": [], - "device-storage:crashes": [], - "device-storage:music": [], - "device-storage:pictures": [], - "device-storage:sdcard": [], - "device-storage:videos": [], + ], + "contacts": [], + "desktop-notification": [], + "device-storage:apps": [], + "device-storage:crashes": [], + "device-storage:music": [], + "device-storage:pictures": [], + "device-storage:sdcard": [], + "device-storage:videos": [], "downloads": [ - "window.DownloadEvent", + "window.DownloadEvent", "window.DOMDownload" - ], + ], "embed-apps": [ "window.BeforeAfterKeyboardEvent" - ], + ], "embed-widgets": [ - "window.document.body.lastElementChild.getVisible", - "window.document.body.lastElementChild.removeNextPaintListener", - "window.document.body.lastElementChild.getActive", - "window.document.body.lastElementChild.setActive", - "window.document.body.lastElementChild.addNextPaintListener", + "window.document.body.lastElementChild.getVisible", + "window.document.body.lastElementChild.removeNextPaintListener", + "window.document.body.lastElementChild.getActive", + "window.document.body.lastElementChild.setActive", + "window.document.body.lastElementChild.addNextPaintListener", "window.document.body.lastElementChild.setVisible" - ], - "engineering-mode": [], + ], + "engineering-mode": [], + "external-app": [ + "window.HTMLExtAppElement", + "window.ExternalAppEvent" + ], "feature-detection": [ - "window.navigator.hasFeature", + "window.navigator.hasFeature", "window.navigator.getFeature" - ], - "firefox-accounts": [], + ], + "firefox-accounts": [], "fmradio": [ "window.navigator.mozFMRadio" - ], - "geolocation": [], - "geolocation-noprompt": [], - "global-clickthrough-overlay": [], - "homescreen-webapps-manage": [], + ], + "geolocation": [], + "geolocation-noprompt": [], + "global-clickthrough-overlay": [], + "homescreen-webapps-manage": [], "idle": [ - "window.navigator.addIdleObserver", + "window.navigator.addIdleObserver", "window.navigator.removeIdleObserver" - ], + ], "input": [ - "window.MozInputMethod", + "window.MozInputMethod", "window.navigator.mozInputMethod" - ], + ], "input-manage": [ - "window.MozInputMethod", + "window.MozInputMethod", "window.navigator.mozInputMethod" - ], + ], "mobileconnection": [ - "window.navigator.mozIccManager", + "window.navigator.mozIccManager", "window.navigator.mozMobileConnections" - ], + ], "mobileid": [ "window.navigator.getMobileIdAssertion" - ], + ], "mobilenetwork": [ "window.navigator.mozMobileConnections" - ], - "moz-attention": [], - "moz-audio-channel-ringer": [], - "moz-audio-channel-telephony": [], - "moz-firefox-accounts": [], - "network-events": [], + ], + "moz-attention": [], + "moz-audio-channel-ringer": [], + "moz-audio-channel-telephony": [], + "moz-firefox-accounts": [], + "network-events": [], "networkstats-manage": [ "window.MozNetworkStatsInterface" - ], - "nfc": [], - "nfc-hci-events": [], - "nfc-manager": [], - "nfc-share": [], + ], + "nfc": [], + "nfc-hci-events": [], + "nfc-manager": [], + "nfc-share": [], "open-remote-window": { - "open-remote-window-allow": true, + "open-remote-window-allow": true, "open-remote-window-deny": false - }, + }, "permissions": [ - "window.PermissionSettings", + "window.PermissionSettings", "window.navigator.mozPermissionSettings" - ], + ], "phonenumberservice": [ - "window.PhoneNumberService", + "window.PhoneNumberService", "window.navigator.mozPhoneNumberService" - ], + ], "power": [ "window.navigator.mozPower" - ], + ], "push": [ "window.navigator.push" - ], - "resourcestats-manage": [], - "secureelement-manage": [], - "settings": [], - "settings-clear": [], - "settings:wallpaper.image": [], + ], + "resourcestats-manage": [], + "secureelement-manage": [], + "settings": [], + "settings-clear": [], + "settings:wallpaper.image": [], "sms": [ "window.navigator.mozMobileMessage" - ], + ], "speaker-control": [ "speaker-control" - ], - "storage": [], + ], + "storage": [], "systemXHR": [ "systemXHR" - ], - "tcp-socket": [], + ], + "tcp-socket": [], "telephony": [ - "window.navigator.mozTelephony", + "window.navigator.mozTelephony", "window.document.body.itemType (expected object)" - ], - "test-permission": [], - "themeable": [], + ], + "test-permission": [], + "themeable": [], "time": [ "window.navigator.mozTime" - ], - "tv": [], + ], + "tv": [], "udp-socket": [ - "window.UDPMessageEvent", + "window.UDPMessageEvent", "window.UDPSocket" - ], - "video-capture": [], + ], + "video-capture": [], "voicemail": [ "window.navigator.mozVoicemail" - ], - "wappush": [], + ], + "wappush": [], "webapps-manage": [ - "device-storage:apps", + "device-storage:apps", "window.navigator.mozApps.mgmt" - ], + ], "wifi-manage": [ - "window.MozWifiP2pGroupOwner", - "window.MozWifiP2pStatusChangeEvent", - "window.MozWifiP2pManager", - "window.MozWifiCapabilities", - "window.MozWifiManager", - "window.MozWifiNetwork", - "window.navigator.mozWifiManager", - "window.navigator.mozWifiP2pManager", - "window.document.body.itemType (expected object)" + "window.MozWifiP2pGroupOwner", + "window.MozWifiP2pStatusChangeEvent", + "window.MozWifiP2pManager", + "window.MozWifiCapabilities", + "window.MozWifiManager", + "window.MozWifiNetwork", + "window.navigator.mozWifiManager", + "window.navigator.mozWifiP2pManager" ] } \ No newline at end of file diff --git a/mcts/static/expected_results/expected_permissions_results/privileged.json b/mcts/static/expected_results/expected_permissions_results/privileged.json index bdf8e763..9ae0465b 100644 --- a/mcts/static/expected_results/expected_permissions_results/privileged.json +++ b/mcts/static/expected_results/expected_permissions_results/privileged.json @@ -1,81 +1,82 @@ { - "alarms": "unknown", - "attention": "unknown", - "audio-capture": "unknown", - "audio-capture:3gpp": "unknown", - "audio-channel-alarm": "unknown", - "audio-channel-content": "unknown", - "audio-channel-normal": "unknown", - "audio-channel-notification": "unknown", - "audio-channel-publicnotification": "unknown", - "audio-channel-ringer": "unknown", - "audio-channel-telephony": "unknown", - "background-sensors": "unknown", - "backgroundservice": "unknown", - "before-after-keyboard-event": "unknown", - "bluetooth": "unknown", - "browser": "unknown", - "camera": "unknown", - "cellbroadcast": "unknown", - "contacts": "unknown", - "desktop-notification": "unknown", - "device-storage:apps": "unknown", - "device-storage:crashes": "unknown", - "device-storage:music": "unknown", - "device-storage:pictures": "unknown", - "device-storage:sdcard": "unknown", - "device-storage:videos": "unknown", - "downloads": "unknown", - "embed-apps": "unknown", - "embed-widgets": "unknown", - "engineering-mode": "unknown", - "feature-detection": "unknown", - "firefox-accounts": "unknown", - "fmradio": "unknown", - "geolocation": "unknown", - "geolocation-noprompt": "unknown", - "global-clickthrough-overlay": "unknown", - "homescreen-webapps-manage": "unknown", - "idle": "unknown", - "input": "unknown", - "input-manage": "unknown", - "mobileconnection": "unknown", - "mobileid": "unknown", - "mobilenetwork": "unknown", - "moz-attention": "unknown", - "moz-audio-channel-ringer": "unknown", - "moz-audio-channel-telephony": "unknown", - "moz-firefox-accounts": "unknown", - "network-events": "unknown", - "networkstats-manage": "unknown", - "nfc": "unknown", - "nfc-hci-events": "unknown", - "nfc-manager": "unknown", - "nfc-share": "unknown", - "open-remote-window": "unknown", - "permissions": "unknown", - "phonenumberservice": "unknown", - "power": "unknown", - "push": "unknown", - "resourcestats-manage": "unknown", - "secureelement-manage": "unknown", - "settings": "unknown", - "settings-clear": "unknown", - "settings:wallpaper.image": "unknown", - "sms": "unknown", - "speaker-control": "unknown", - "storage": "unknown", - "systemXHR": "unknown", - "tcp-socket": "unknown", - "telephony": "unknown", - "test-permission": "unknown", - "themeable": "unknown", - "time": "unknown", - "tv": "unknown", - "udp-socket": "unknown", - "video-capture": "unknown", - "voicemail": "unknown", - "wappush": "unknown", - "webapps-manage": "unknown", + "alarms": "unknown", + "attention": "unknown", + "audio-capture": "unknown", + "audio-capture:3gpp": "unknown", + "audio-channel-alarm": "unknown", + "audio-channel-content": "unknown", + "audio-channel-normal": "unknown", + "audio-channel-notification": "unknown", + "audio-channel-publicnotification": "unknown", + "audio-channel-ringer": "unknown", + "audio-channel-telephony": "unknown", + "background-sensors": "unknown", + "backgroundservice": "unknown", + "before-after-keyboard-event": "unknown", + "bluetooth": "unknown", + "browser": "unknown", + "camera": "unknown", + "cellbroadcast": "unknown", + "contacts": "unknown", + "desktop-notification": "unknown", + "device-storage:apps": "unknown", + "device-storage:crashes": "unknown", + "device-storage:music": "unknown", + "device-storage:pictures": "unknown", + "device-storage:sdcard": "unknown", + "device-storage:videos": "unknown", + "downloads": "unknown", + "embed-apps": "unknown", + "embed-widgets": "unknown", + "engineering-mode": "unknown", + "external-app": "unknown", + "feature-detection": "unknown", + "firefox-accounts": "unknown", + "fmradio": "unknown", + "geolocation": "unknown", + "geolocation-noprompt": "unknown", + "global-clickthrough-overlay": "unknown", + "homescreen-webapps-manage": "unknown", + "idle": "unknown", + "input": "unknown", + "input-manage": "unknown", + "mobileconnection": "unknown", + "mobileid": "unknown", + "mobilenetwork": "unknown", + "moz-attention": "unknown", + "moz-audio-channel-ringer": "unknown", + "moz-audio-channel-telephony": "unknown", + "moz-firefox-accounts": "unknown", + "network-events": "unknown", + "networkstats-manage": "unknown", + "nfc": "unknown", + "nfc-hci-events": "unknown", + "nfc-manager": "unknown", + "nfc-share": "unknown", + "open-remote-window": "unknown", + "permissions": "unknown", + "phonenumberservice": "unknown", + "power": "unknown", + "push": "unknown", + "resourcestats-manage": "unknown", + "secureelement-manage": "unknown", + "settings": "unknown", + "settings-clear": "unknown", + "settings:wallpaper.image": "unknown", + "sms": "unknown", + "speaker-control": "unknown", + "storage": "unknown", + "systemXHR": "unknown", + "tcp-socket": "unknown", + "telephony": "unknown", + "test-permission": "unknown", + "themeable": "unknown", + "time": "unknown", + "tv": "unknown", + "udp-socket": "unknown", + "video-capture": "unknown", + "voicemail": "unknown", + "wappush": "unknown", + "webapps-manage": "unknown", "wifi-manage": "unknown" } \ No newline at end of file diff --git a/mcts/static/expected_results/expected_permissions_results/web.json b/mcts/static/expected_results/expected_permissions_results/web.json index bdf8e763..9ae0465b 100644 --- a/mcts/static/expected_results/expected_permissions_results/web.json +++ b/mcts/static/expected_results/expected_permissions_results/web.json @@ -1,81 +1,82 @@ { - "alarms": "unknown", - "attention": "unknown", - "audio-capture": "unknown", - "audio-capture:3gpp": "unknown", - "audio-channel-alarm": "unknown", - "audio-channel-content": "unknown", - "audio-channel-normal": "unknown", - "audio-channel-notification": "unknown", - "audio-channel-publicnotification": "unknown", - "audio-channel-ringer": "unknown", - "audio-channel-telephony": "unknown", - "background-sensors": "unknown", - "backgroundservice": "unknown", - "before-after-keyboard-event": "unknown", - "bluetooth": "unknown", - "browser": "unknown", - "camera": "unknown", - "cellbroadcast": "unknown", - "contacts": "unknown", - "desktop-notification": "unknown", - "device-storage:apps": "unknown", - "device-storage:crashes": "unknown", - "device-storage:music": "unknown", - "device-storage:pictures": "unknown", - "device-storage:sdcard": "unknown", - "device-storage:videos": "unknown", - "downloads": "unknown", - "embed-apps": "unknown", - "embed-widgets": "unknown", - "engineering-mode": "unknown", - "feature-detection": "unknown", - "firefox-accounts": "unknown", - "fmradio": "unknown", - "geolocation": "unknown", - "geolocation-noprompt": "unknown", - "global-clickthrough-overlay": "unknown", - "homescreen-webapps-manage": "unknown", - "idle": "unknown", - "input": "unknown", - "input-manage": "unknown", - "mobileconnection": "unknown", - "mobileid": "unknown", - "mobilenetwork": "unknown", - "moz-attention": "unknown", - "moz-audio-channel-ringer": "unknown", - "moz-audio-channel-telephony": "unknown", - "moz-firefox-accounts": "unknown", - "network-events": "unknown", - "networkstats-manage": "unknown", - "nfc": "unknown", - "nfc-hci-events": "unknown", - "nfc-manager": "unknown", - "nfc-share": "unknown", - "open-remote-window": "unknown", - "permissions": "unknown", - "phonenumberservice": "unknown", - "power": "unknown", - "push": "unknown", - "resourcestats-manage": "unknown", - "secureelement-manage": "unknown", - "settings": "unknown", - "settings-clear": "unknown", - "settings:wallpaper.image": "unknown", - "sms": "unknown", - "speaker-control": "unknown", - "storage": "unknown", - "systemXHR": "unknown", - "tcp-socket": "unknown", - "telephony": "unknown", - "test-permission": "unknown", - "themeable": "unknown", - "time": "unknown", - "tv": "unknown", - "udp-socket": "unknown", - "video-capture": "unknown", - "voicemail": "unknown", - "wappush": "unknown", - "webapps-manage": "unknown", + "alarms": "unknown", + "attention": "unknown", + "audio-capture": "unknown", + "audio-capture:3gpp": "unknown", + "audio-channel-alarm": "unknown", + "audio-channel-content": "unknown", + "audio-channel-normal": "unknown", + "audio-channel-notification": "unknown", + "audio-channel-publicnotification": "unknown", + "audio-channel-ringer": "unknown", + "audio-channel-telephony": "unknown", + "background-sensors": "unknown", + "backgroundservice": "unknown", + "before-after-keyboard-event": "unknown", + "bluetooth": "unknown", + "browser": "unknown", + "camera": "unknown", + "cellbroadcast": "unknown", + "contacts": "unknown", + "desktop-notification": "unknown", + "device-storage:apps": "unknown", + "device-storage:crashes": "unknown", + "device-storage:music": "unknown", + "device-storage:pictures": "unknown", + "device-storage:sdcard": "unknown", + "device-storage:videos": "unknown", + "downloads": "unknown", + "embed-apps": "unknown", + "embed-widgets": "unknown", + "engineering-mode": "unknown", + "external-app": "unknown", + "feature-detection": "unknown", + "firefox-accounts": "unknown", + "fmradio": "unknown", + "geolocation": "unknown", + "geolocation-noprompt": "unknown", + "global-clickthrough-overlay": "unknown", + "homescreen-webapps-manage": "unknown", + "idle": "unknown", + "input": "unknown", + "input-manage": "unknown", + "mobileconnection": "unknown", + "mobileid": "unknown", + "mobilenetwork": "unknown", + "moz-attention": "unknown", + "moz-audio-channel-ringer": "unknown", + "moz-audio-channel-telephony": "unknown", + "moz-firefox-accounts": "unknown", + "network-events": "unknown", + "networkstats-manage": "unknown", + "nfc": "unknown", + "nfc-hci-events": "unknown", + "nfc-manager": "unknown", + "nfc-share": "unknown", + "open-remote-window": "unknown", + "permissions": "unknown", + "phonenumberservice": "unknown", + "power": "unknown", + "push": "unknown", + "resourcestats-manage": "unknown", + "secureelement-manage": "unknown", + "settings": "unknown", + "settings-clear": "unknown", + "settings:wallpaper.image": "unknown", + "sms": "unknown", + "speaker-control": "unknown", + "storage": "unknown", + "systemXHR": "unknown", + "tcp-socket": "unknown", + "telephony": "unknown", + "test-permission": "unknown", + "themeable": "unknown", + "time": "unknown", + "tv": "unknown", + "udp-socket": "unknown", + "video-capture": "unknown", + "voicemail": "unknown", + "wappush": "unknown", + "webapps-manage": "unknown", "wifi-manage": "unknown" } \ No newline at end of file diff --git a/mcts/static/expected_results/expected_webapi_results/certified.json b/mcts/static/expected_results/expected_webapi_results/certified.json index 0284269d..eb901fb0 100644 --- a/mcts/static/expected_results/expected_webapi_results/certified.json +++ b/mcts/static/expected_results/expected_webapi_results/certified.json @@ -47704,6 +47704,7 @@ "cancelAnimationFrame": true, "captureEvents": true, "clearInterval": true, + "clearMaxGCPauseAccumulator": true, "clearTimeout": true, "close": true, "closed": true, @@ -50785,6 +50786,7 @@ }, "done": true, "dump": true, + "dumpProfile": true, "encodeURI": true, "encodeURIComponent": true, "escape": true, @@ -50798,6 +50800,7 @@ "generate_tests": true, "getComputedStyle": true, "getDefaultComputedStyle": true, + "getMaxGCPauseSinceClear": true, "getSelection": true, "getTheNames": true, "hasOwnProperty": true, @@ -51952,7 +51955,49 @@ "__lookupSetter__": true, "active": null, "addEventListener": true, - "calls": true, + "calls": { + "__defineGetter__": true, + "__defineSetter__": true, + "__lookupGetter__": true, + "__lookupSetter__": true, + "concat": true, + "constructor": true, + "copyWithin": true, + "entries": true, + "every": true, + "fill": true, + "filter": true, + "find": true, + "findIndex": true, + "forEach": true, + "hasOwnProperty": true, + "indexOf": true, + "isPrototypeOf": true, + "item": true, + "join": true, + "keys": true, + "lastIndexOf": true, + "length": true, + "map": true, + "pop": true, + "propertyIsEnumerable": true, + "push": true, + "reduce": true, + "reduceRight": true, + "reverse": true, + "shift": true, + "slice": true, + "some": true, + "sort": true, + "splice": true, + "toLocaleString": true, + "toSource": true, + "toString": true, + "unshift": true, + "unwatch": true, + "valueOf": true, + "watch": true + }, "conferenceGroup": { "__defineGetter__": true, "__defineSetter__": true, @@ -52308,7 +52353,7 @@ "frequency": true, "hasOwnProperty": true, "hidden": true, - "identity": null, + "identity": true, "isPrototypeOf": true, "keyManagement": null, "known": true, @@ -52323,6 +52368,7 @@ "relSignalStrength": null, "scan_ssid": null, "security": { + "0": true, "__defineGetter__": true, "__defineSetter__": true, "__lookupGetter__": true, @@ -52663,6 +52709,7 @@ "parent": true, "parseFloat": true, "parseInt": true, + "pauseProfilers": true, "performance": { "__defineGetter__": true, "__defineSetter__": true, @@ -52761,6 +52808,7 @@ "requestAnimationFrame": true, "resizeBy": true, "resizeTo": true, + "resumeProfilers": true, "runTest": true, "screen": { "__defineGetter__": true, @@ -52838,9 +52886,11 @@ "valueOf": true, "watch": true }, + "startProfiling": true, "status": true, "statusbar": true, "stop": true, + "stopProfiling": true, "test": true, "timeout": true, "toLocaleString": true, diff --git a/mcts/static/expected_results/expected_webapi_results/privileged.json b/mcts/static/expected_results/expected_webapi_results/privileged.json index b3d04583..9affc15d 100644 --- a/mcts/static/expected_results/expected_webapi_results/privileged.json +++ b/mcts/static/expected_results/expected_webapi_results/privileged.json @@ -47671,6 +47671,7 @@ "cancelAnimationFrame": true, "captureEvents": true, "clearInterval": true, + "clearMaxGCPauseAccumulator": true, "clearTimeout": true, "close": true, "closed": true, @@ -50740,6 +50741,7 @@ }, "done": true, "dump": true, + "dumpProfile": true, "encodeURI": true, "encodeURIComponent": true, "escape": true, @@ -50753,6 +50755,7 @@ "generate_tests": true, "getComputedStyle": true, "getDefaultComputedStyle": true, + "getMaxGCPauseSinceClear": true, "getSelection": true, "getTheNames": true, "hasOwnProperty": true, @@ -51567,6 +51570,7 @@ "parent": true, "parseFloat": true, "parseInt": true, + "pauseProfilers": true, "performance": { "__defineGetter__": true, "__defineSetter__": true, @@ -51665,6 +51669,7 @@ "requestAnimationFrame": true, "resizeBy": true, "resizeTo": true, + "resumeProfilers": true, "runTest": true, "screen": { "__defineGetter__": true, @@ -51742,9 +51747,11 @@ "valueOf": true, "watch": true }, + "startProfiling": true, "status": true, "statusbar": true, "stop": true, + "stopProfiling": true, "test": true, "timeout": true, "toLocaleString": true, diff --git a/mcts/static/expected_results/expected_webapi_results/web.json b/mcts/static/expected_results/expected_webapi_results/web.json index 5bdbc6c4..f112cd2f 100644 --- a/mcts/static/expected_results/expected_webapi_results/web.json +++ b/mcts/static/expected_results/expected_webapi_results/web.json @@ -47653,6 +47653,7 @@ "cancelAnimationFrame": true, "captureEvents": true, "clearInterval": true, + "clearMaxGCPauseAccumulator": true, "clearTimeout": true, "close": true, "closed": true, @@ -50722,6 +50723,7 @@ }, "done": true, "dump": true, + "dumpProfile": true, "encodeURI": true, "encodeURIComponent": true, "escape": true, @@ -50735,6 +50737,7 @@ "generate_tests": true, "getComputedStyle": true, "getDefaultComputedStyle": true, + "getMaxGCPauseSinceClear": true, "getSelection": true, "getTheNames": true, "hasOwnProperty": true, @@ -51353,6 +51356,7 @@ "parent": true, "parseFloat": true, "parseInt": true, + "pauseProfilers": true, "performance": { "__defineGetter__": true, "__defineSetter__": true, @@ -51451,6 +51455,7 @@ "requestAnimationFrame": true, "resizeBy": true, "resizeTo": true, + "resumeProfilers": true, "runTest": true, "screen": { "__defineGetter__": true, @@ -51528,9 +51533,11 @@ "valueOf": true, "watch": true }, + "startProfiling": true, "status": true, "statusbar": true, "stop": true, + "stopProfiling": true, "test": true, "timeout": true, "toLocaleString": true, diff --git a/mcts/utils/device/devicehelper.py b/mcts/utils/device/devicehelper.py index 9a92c11d..02d058d9 100644 --- a/mcts/utils/device/devicehelper.py +++ b/mcts/utils/device/devicehelper.py @@ -2,7 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -from mozdevice import DeviceManagerADB +from mcts.utils.handlers.adb_b2g import ADBB2G from marionette import Marionette class DeviceHelper(object): @@ -10,7 +10,7 @@ class DeviceHelper(object): marionette = None @staticmethod - def getDevice(DeviceManager=DeviceManagerADB, **kwargs): + def getDevice(DeviceManager=ADBB2G, **kwargs): if not DeviceHelper.device: DeviceHelper.device = DeviceManager(**kwargs) diff --git a/mcts/utils/handlers/adb_b2g.py b/mcts/utils/handlers/adb_b2g.py index 84e2f3f5..fffbb1e0 100644 --- a/mcts/utils/handlers/adb_b2g.py +++ b/mcts/utils/handlers/adb_b2g.py @@ -292,3 +292,53 @@ def get_profiles(self, profile_base="/data/b2g/mozilla", timeout=None): proc.stderr_file.close() return rv + + def devices(self, timeout=None): + """Executes adb devices -l and returns a list of objects describing attached devices. + + :param timeout: optional integer specifying the maximum time in + seconds for any spawned adb process to complete before + throwing an ADBTimeoutError. This timeout is per adb call. The + total time spent may exceed this value. If it is not + specified, the value set in the ADBHost constructor is used. + :returns: an object contain + :raises: * ADBTimeoutError + * ADBError + + The output of adb devices -l :: + + $ adb devices -l + List of devices attached + b313b945 device usb:1-7 product:d2vzw model:SCH_I535 device:d2vzw + + is parsed and placed into an object as in + + [{'device_serial': 'b313b945', 'state': 'device', 'product': 'd2vzw', + 'usb': '1-7', 'device': 'd2vzw', 'model': 'SCH_I535' }] + + """ + # b313b945 device usb:1-7 product:d2vzw model:SCH_I535 device:d2vzw + # from Android system/core/adb/transport.c statename() + re_device_info = re.compile(r'([^\s]+)\s+(offline|bootloader|device|host|recovery|sideload|no permissions|unauthorized|unknown)') + devices = [] + lines = self.command_output(["devices", "-l"], timeout=timeout).split('\n') + for line in lines: + if line == 'List of devices attached ': + continue + match = re_device_info.match(line) + if match: + device = { + 'device_serial': match.group(1), + 'state': match.group(2) + } + remainder = line[match.end(2):].strip() + if remainder: + try: + device.update(dict([j.split(':') + for j in remainder.split(' ')])) + except ValueError: + self._logger.warning('devices: Unable to parse ' + 'remainder for device %s' % line) + devices.append(device) + return devices + diff --git a/mcts/webapi_tests/semiauto/testcase.py b/mcts/webapi_tests/semiauto/testcase.py index 1d487f2e..d20d3564 100644 --- a/mcts/webapi_tests/semiauto/testcase.py +++ b/mcts/webapi_tests/semiauto/testcase.py @@ -22,7 +22,7 @@ prompt_timeout = 600 # 10 minutes # local variable for marionette -_host = 'localhos' +_host = 'localhost' _port = 2828 class TestCase(unittest.TestCase): @@ -76,8 +76,11 @@ def setUp(self): env = environment.get(InProcessTestEnvironment) - if env.device_profile: - self.check_skip(env.device_profile['webapi']) + try: + if env.device_profile: + self.check_skip(env.device_profile['webapi']) + except: + self.test_name = str(self.__class__).split('.')[1] self.server = env.server self.handler = env.handler @@ -202,7 +205,7 @@ def close_app_manually(self): "Please close the app manually by holding down the Home button " "and pressing the X above the %s card." % (certapp.name, certapp.name)) if not success: - device = mozdevice.DeviceManagerADB() + device = DeviceHelper.getDevice() device.reboot(wait=True) self.instruct("Please unlock the lockscreen (if present) after device reboots") self.fail("Failed attempts at closing certapp") diff --git a/mcts/webapi_tests/telephony/telephony_test.py b/mcts/webapi_tests/telephony/telephony_test.py index 8b1cddea..2f4b9d13 100644 --- a/mcts/webapi_tests/telephony/telephony_test.py +++ b/mcts/webapi_tests/telephony/telephony_test.py @@ -152,6 +152,15 @@ def user_guided_incoming_call(self): hear the ringing signal click 'OK'") self.verify_incoming_call() + def resume(self): + self.marionette.execute_async_script(""" + if (window.wrappedJSObject.calls.length > 0) { + window.wrappedJSObject.calls[0].resume(); + } + + marionetteScriptFinished(1); + """, special_powers=True) + def hangup_call(self, call_type="Active", remote_hangup=False, active_call_selected=0): # hangup the active/incoming call, verify self.marionette.execute_async_script(""" @@ -200,10 +209,6 @@ def hangup_call(self, call_type="Active", remote_hangup=False, active_call_selec call_to_hangup.hangUp(); } - if (window.wrappedJSObject.calls.length > 0) { - window.wrappedJSObject.calls[0].resume(); - } - marionetteScriptFinished(1); """, script_args=[call_type, remote_hangup, active_call_selected], special_powers=True) diff --git a/mcts/webapi_tests/telephony/test_telephony_incoming_hold_outgoing.py b/mcts/webapi_tests/telephony/test_telephony_incoming_hold_outgoing.py index 3324be20..a0a990fa 100644 --- a/mcts/webapi_tests/telephony/test_telephony_incoming_hold_outgoing.py +++ b/mcts/webapi_tests/telephony/test_telephony_incoming_hold_outgoing.py @@ -102,6 +102,7 @@ def test_telephony_incoming_hold_outgoing(self): wait = Wait(self.marionette, timeout=10, interval=0.5) try: wait.until(lambda x: x.execute_script("return (window.wrappedJSObject.calls.length == 1)")) + self.resume() wait.until(lambda x: x.execute_script("return (window.wrappedJSObject.calls[0].state == \"connected\")")) except: self.fail("Failed to hangup the second call or change the state of first call") diff --git a/mcts/webapi_tests/telephony/test_telephony_incoming_multiple.py b/mcts/webapi_tests/telephony/test_telephony_incoming_multiple.py index 58ae5e5a..86a05302 100644 --- a/mcts/webapi_tests/telephony/test_telephony_incoming_multiple.py +++ b/mcts/webapi_tests/telephony/test_telephony_incoming_multiple.py @@ -98,6 +98,7 @@ def test_telephony_incoming_multiple(self): wait = Wait(self.marionette, timeout=10, interval=0.5) try: wait.until(lambda x: x.execute_script("return (window.wrappedJSObject.calls.length == 1)")) + self.resume() wait.until(lambda x: x.execute_script("return (window.wrappedJSObject.calls[0].state == \"connected\")")) except: self.fail("Failed to hangup the second call or change the state of first call")