Ejemplo n.º 1
0
    def do_testharness(self, marionette, url, timeout):
        if self.close_after_done:
            marionette.execute_script("if (window.wrappedJSObject.win) {window.wrappedJSObject.win.close()}")

        if timeout is not None:
            timeout_ms = str(timeout * 1000)
        else:
            timeout_ms = "null"

        script = self.script % {"abs_url": url,
                                "url": strip_server(url),
                                "window_id": self.window_id,
                                "timeout_multiplier": self.timeout_multiplier,
                                "timeout": timeout_ms,
                                "explicit_timeout": timeout is None}

        return marionette.execute_async_script(script, new_sandbox=False)
Ejemplo n.º 2
0
    runner = mozrunner.B2GRunner(profile,
                                 device,
                                 marionette,
                                 context_chrome=False)
    runner.start()

    # Setup Gaia
    marionette.switch_to_frame()
    time.sleep(5)
    lock = gaiatest.LockScreen(marionette)
    lock.unlock()

    # Setup Firefox
    apps = gaiatest.GaiaApps(marionette)
    apps.launch('browser', switch_to_frame=True)
    marionette.execute_script(
        "return window.wrappedJSObject.Browser.navigate('%s')" % args.url)

    # Handle logging
    while 1:
        logcat = device.getLogcat()
        if len(logcat) >= 1000:
            with open("/Users/cdiehl/Desktop/logcat.txt", "w") as fo:
                fo.write("".join(logcat))
            logcat = []
            device.recordLogcat()
        if marionette.check_for_crash():
            logging.error("Crash detected!")
            sys.exit(0)
        time.sleep(5)