Bug 1368674 - Remove simpleTest functionality from Marionette. r?whimboo draft
authorDavid Burns <dburns@mozilla.com>
Tue, 30 May 2017 13:51:02 +0100
changeset 589591 1bd3811cc564d640bc1cc2bece3e5e007cb0e731
parent 589212 4d5328d66663b380382913a36caf877c65258540
child 589592 7e48c0626f8ccf0b05bd7876123be12665a9e319
push id62440
push userbmo:dburns@mozilla.com
push dateTue, 06 Jun 2017 12:57:42 +0000
reviewerswhimboo
bugs1368674
milestone55.0a1
Bug 1368674 - Remove simpleTest functionality from Marionette. r?whimboo This is a remanent of the B2G code for injecting Mochitest style tests into Gecko. This is no longer used by anything and is now dead code. MozReview-Commit-ID: 4qaB3vxQzon
testing/marionette/driver.js
testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_chrome.js
testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_fail.js
testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_pass.js
testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_sanity.py
testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_timeout.js
testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
testing/marionette/listener.js
testing/marionette/simpletest.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -30,17 +30,16 @@ Cu.import("chrome://marionette/content/e
 Cu.import("chrome://marionette/content/event.js");
 Cu.import("chrome://marionette/content/interaction.js");
 Cu.import("chrome://marionette/content/l10n.js");
 Cu.import("chrome://marionette/content/legacyaction.js");
 Cu.import("chrome://marionette/content/logging.js");
 Cu.import("chrome://marionette/content/modal.js");
 Cu.import("chrome://marionette/content/proxy.js");
 Cu.import("chrome://marionette/content/session.js");
-Cu.import("chrome://marionette/content/simpletest.js");
 Cu.import("chrome://marionette/content/wait.js");
 
 this.EXPORTED_SYMBOLS = ["GeckoDriver", "Context"];
 
 var FRAME_SCRIPT = "chrome://marionette/content/listener.js";
 
 const CLICK_TO_START_PREF = "marionette.debugging.clicktostart";
 const CONTENT_LISTENER_PREF = "marionette.contentListener";
@@ -889,59 +888,16 @@ GeckoDriver.prototype.execute_ = functio
       opts.timeout = timeout;
       let wargs = evaluate.fromJSON(args, this.curBrowser.seenEls, sb.window);
       let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
       return evaluatePromise.then(res => evaluate.toJSON(res, this.curBrowser.seenEls));
   }
 };
 
 /**
- * Execute pure JavaScript.  Used to execute simpletest harness tests,
- * which are like mochitests only injected using Marionette.
- *
- * Scripts are expected to call the {@code finish} global when done.
- */
-GeckoDriver.prototype.executeJSScript = function* (cmd, resp) {
-  let win = assert.window(this.getCurrentWindow());
-
-  let {script, args, scriptTimeout} = cmd.parameters;
-  scriptTimeout = scriptTimeout || this.timeouts.script;
-
-  let opts = {
-    filename: cmd.parameters.filename,
-    line: cmd.parameters.line,
-    async: cmd.parameters.async,
-  };
-
-  switch (this.context) {
-    case Context.CHROME:
-      let wargs = evaluate.fromJSON(args, this.curBrowser.seenEls, win);
-      let harness = new simpletest.Harness(
-          win,
-          Context.CHROME,
-          this.marionetteLog,
-          scriptTimeout,
-          function() {},
-          this.testName);
-
-      let sb = sandbox.createSimpleTest(win, harness);
-      // TODO(ato): Not sure this is needed:
-      sb = sandbox.augment(sb, new logging.Adapter(this.marionetteLog));
-
-      let res = yield evaluate.sandbox(sb, script, wargs, opts);
-      resp.body.value = evaluate.toJSON(res, this.curBrowser.seenEls);
-      break;
-
-    case Context.CONTENT:
-      resp.body.value = yield this.listener.executeSimpleTest(script, args, scriptTimeout, opts);
-      break;
-  }
-};
-
-/**
  * Navigate to given URL.
  *
  * Navigates the current browsing context to the given URL and waits for
  * the document to load or the session's page timeout duration to elapse
  * before returning.
  *
  * The command will return with a failure if there is an error loading
  * the document or the URL is blocked.  This can occur if it fails to
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
@@ -24,29 +24,16 @@ globals = set([
               "btoa",
               "document",
               "navigator",
               "URL",
               "window",
               ])
 
 
-class TestExecuteSimpleTestContent(MarionetteTestCase):
-    def test_stack_trace(self):
-        try:
-            self.marionette.execute_js_script("""
-                let a = 1;
-                throwHere();
-                """, filename="file.js")
-            self.assertFalse(True)
-        except errors.JavascriptException as e:
-            self.assertIn("throwHere is not defined", e.message)
-            self.assertIn("@file.js:2", e.stacktrace)
-
-
 class TestExecuteContent(MarionetteTestCase):
 
     def assert_is_defined(self, property, sandbox="default"):
         self.assertTrue(self.marionette.execute_script(
             "return typeof arguments[0] != 'undefined'", [property], sandbox=sandbox),
             "property {} is undefined".format(property))
 
     def assert_is_web_element(self, element):
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_chrome.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-MARIONETTE_TIMEOUT = 1000;
-MARIONETTE_CONTEXT = 'chrome';
-
-is(2, 2, "test for is()");
-isnot(2, 3, "test for isnot()");
-ok(2 == 2, "test for ok()");
-finish();
-
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_fail.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-MARIONETTE_TIMEOUT = 1000;
-
-/* this test will fail */
-
-setTimeout(function() { 
-    is(1, 2, "is(1,2) should fail", TEST_UNEXPECTED_FAIL, TEST_PASS); 
-    finish();
-}, 100);
-isnot(1, 1, "isnot(1,1) should fail", TEST_UNEXPECTED_FAIL, TEST_PASS);
-ok(1 == 2, "ok(1==2) should fail", TEST_UNEXPECTED_FAIL, TEST_PASS);
-
-
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_pass.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-MARIONETTE_TIMEOUT = 1000;
-
-is(2, 2, "test for is()");
-isnot(2, 3, "test for isnot()");
-ok(2 == 2, "test for ok()");
-
-setTimeout(finish, 100);
-
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_sanity.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# 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 marionette_harness import MarionetteTestCase
-
-
-class SimpletestSanityTest(MarionetteTestCase):
-    callFinish = "return finish();"
-
-    def run_sync(self, test):
-        return self.marionette.execute_js_script(test, async=False)
-
-    def run_async(self, test):
-        return self.marionette.execute_js_script(test)
-
-    def test_is(self):
-        def runtests():
-            sentFail1 = "is(true, false, 'isTest1', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
-            sentFail2 = "is(true, false, 'isTest2', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
-            sentPass1 = "is(true, true, 'isTest3');" + self.callFinish
-            sentPass2 = "is(true, true, 'isTest4');" + self.callFinish
-
-            self.assertEqual(1, len(self.run_sync(sentFail1)["failures"]))
-            self.assertEqual(0, self.run_sync(sentFail2)["passed"])
-            self.assertEqual(1, self.run_sync(sentPass1)["passed"])
-            self.assertEqual(0, len(self.run_sync(sentPass2)["failures"]))
-
-            self.marionette.timeout.script = 1
-            self.assertEqual(1, len(self.run_async(sentFail1)["failures"]))
-            self.assertEqual(0, self.run_async(sentFail2)["passed"])
-            self.assertEqual(1, self.run_async(sentPass1)["passed"])
-            self.assertEqual(0, len(self.run_async(sentPass2)["failures"]))
-
-        self.marionette.set_context("content")
-        runtests()
-        self.marionette.set_context("chrome")
-        runtests()
-
-    def test_isnot(self):
-        def runtests():
-           sentFail1 = "isnot(true, true, 'isnotTest3', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
-           sentFail2 = "isnot(true, true, 'isnotTest4', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
-           sentPass1 = "isnot(true, false, 'isnotTest1');" + self.callFinish
-           sentPass2 = "isnot(true, false, 'isnotTest2');" + self.callFinish
-
-           self.assertEqual(1, len(self.run_sync(sentFail1)["failures"]));
-           self.assertEqual(0, self.run_sync(sentFail2)["passed"]);
-           self.assertEqual(0, len(self.run_sync(sentPass1)["failures"]));
-           self.assertEqual(1, self.run_sync(sentPass2)["passed"]);
-
-           self.marionette.timeout.script = 1
-           self.assertEqual(1, len(self.run_async(sentFail1)["failures"]));
-           self.assertEqual(0, self.run_async(sentFail2)["passed"]);
-           self.assertEqual(0, len(self.run_async(sentPass1)["failures"]));
-           self.assertEqual(1, self.run_async(sentPass2)["passed"]);
-
-        self.marionette.set_context("content")
-        runtests()
-        self.marionette.set_context("chrome")
-        runtests()
-
-    def test_ok(self):
-        def runtests():
-            sentFail1 = "ok(1==2, 'testOk1', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
-            sentFail2 = "ok(1==2, 'testOk2', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
-            sentPass1 = "ok(1==1, 'testOk3');" + self.callFinish
-            sentPass2 = "ok(1==1, 'testOk4');" + self.callFinish
-
-            self.assertEqual(1, len(self.run_sync(sentFail1)["failures"]));
-            self.assertEqual(0, self.run_sync(sentFail2)["passed"]);
-            self.assertEqual(0, len(self.run_sync(sentPass1)["failures"]));
-            self.assertEqual(1, self.run_sync(sentPass2)["passed"]);
-
-            self.marionette.timeout.script = 1
-            self.assertEqual(1, len(self.run_async(sentFail1)["failures"]));
-            self.assertEqual(0, self.run_async(sentFail2)["passed"]);
-            self.assertEqual(0, len(self.run_async(sentPass1)["failures"]));
-            self.assertEqual(1, self.run_async(sentPass2)["passed"]);
-
-        self.marionette.set_context("content")
-        runtests()
-        self.marionette.set_context("chrome")
-        runtests()
-
-    def test_todo(self):
-        def runtests():
-            sentFail1 = "todo(1==1, 'testTodo1', TEST_UNEXPECTED_PASS, TEST_KNOWN_FAIL);" + self.callFinish
-            sentFail2 = "todo(1==1, 'testTodo2', TEST_UNEXPECTED_PASS, TEST_KNOWN_FAIL);" + self.callFinish
-            sentPass1 = "todo(1==2, 'testTodo3');" + self.callFinish
-            sentPass2 = "todo(1==2, 'testTodo4');" + self.callFinish
-
-            self.assertEqual(1, len(self.run_sync(sentFail1)["unexpectedSuccesses"]));
-            self.assertEqual(0, len(self.run_sync(sentFail2)["expectedFailures"]));
-            self.assertEqual(0, len(self.run_sync(sentPass1)["unexpectedSuccesses"]));
-            self.assertEqual(1, len(self.run_sync(sentPass2)["expectedFailures"]));
-
-            self.marionette.timeout.script = 1
-            self.assertEqual(1, len(self.run_async(sentFail1)["unexpectedSuccesses"]));
-            self.assertEqual(0, len(self.run_async(sentFail2)["expectedFailures"]));
-            self.assertEqual(0, len(self.run_async(sentPass1)["unexpectedSuccesses"]));
-            self.assertEqual(1, len(self.run_async(sentPass2)["expectedFailures"]));
-
-        self.marionette.set_context("content")
-        runtests()
-        self.marionette.set_context("chrome")
-        runtests()
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_simpletest_timeout.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-MARIONETTE_TIMEOUT = 100;
-
-/* this test will timeout */
-
-function do_test() {
-  is(1, 1);
-  isnot(1, 2);
-  ok(1 == 1);
-  finish();
-}
-
-setTimeout(do_test, 1000);
--- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
@@ -28,33 +28,28 @@ skip-if = true # "Bug 896046"
 
 [test_clearing.py]
 [test_typing.py]
 
 [test_log.py]
 
 [test_execute_async_script.py]
 [test_execute_script.py]
-[test_simpletest_fail.js]
 [test_element_retrieval.py]
 [test_findelement_chrome.py]
 skip-if = appname == 'fennec'
 
 [test_get_current_url_chrome.py]
 [test_navigation.py]
 
 [test_timeouts.py]
 
 [test_single_finger_desktop.py]
 skip-if = appname == 'fennec' || os == "win" # Bug 1025040
 
-[test_simpletest_pass.js]
-[test_simpletest_sanity.py]
-[test_simpletest_chrome.js]
-[test_simpletest_timeout.js]
 [test_anonymous_content.py]
 skip-if = appname == 'fennec'
 [test_switch_frame.py]
 [test_switch_frame_chrome.py]
 skip-if = appname == 'fennec'
 [test_switch_remote_frame.py]
 skip-if = appname == 'fennec'
 [test_switch_window_chrome.py]
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -22,17 +22,16 @@ Cu.import("chrome://marionette/content/e
 Cu.import("chrome://marionette/content/evaluate.js");
 Cu.import("chrome://marionette/content/event.js");
 Cu.import("chrome://marionette/content/interaction.js");
 Cu.import("chrome://marionette/content/legacyaction.js");
 Cu.import("chrome://marionette/content/logging.js");
 Cu.import("chrome://marionette/content/navigate.js");
 Cu.import("chrome://marionette/content/proxy.js");
 Cu.import("chrome://marionette/content/session.js");
-Cu.import("chrome://marionette/content/simpletest.js");
 
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 Cu.importGlobalProperties(["URL"]);
 
@@ -483,27 +482,25 @@ var performActionsFn = dispatch(performA
 var releaseActionsFn = dispatch(releaseActions);
 var actionChainFn = dispatch(actionChain);
 var multiActionFn = dispatch(multiAction);
 var addCookieFn = dispatch(addCookie);
 var deleteCookieFn = dispatch(deleteCookie);
 var deleteAllCookiesFn = dispatch(deleteAllCookies);
 var executeFn = dispatch(execute);
 var executeInSandboxFn = dispatch(executeInSandbox);
-var executeSimpleTestFn = dispatch(executeSimpleTest);
 var sendKeysToElementFn = dispatch(sendKeysToElement);
 
 /**
  * Start all message listeners
  */
 function startListeners() {
   addMessageListenerId("Marionette:newSession", newSession);
   addMessageListenerId("Marionette:execute", executeFn);
   addMessageListenerId("Marionette:executeInSandbox", executeInSandboxFn);
-  addMessageListenerId("Marionette:executeSimpleTest", executeSimpleTestFn);
   addMessageListenerId("Marionette:singleTap", singleTapFn);
   addMessageListenerId("Marionette:performActions", performActionsFn);
   addMessageListenerId("Marionette:releaseActions", releaseActionsFn);
   addMessageListenerId("Marionette:actionChain", actionChainFn);
   addMessageListenerId("Marionette:multiAction", multiActionFn);
   addMessageListenerId("Marionette:get", get);
   addMessageListenerId("Marionette:waitForPageLoaded", waitForPageLoaded);
   addMessageListenerId("Marionette:cancelRequest", cancelRequest);
@@ -569,17 +566,16 @@ function restart(msg) {
 
 /**
  * Removes all listeners
  */
 function deleteSession(msg) {
   removeMessageListenerId("Marionette:newSession", newSession);
   removeMessageListenerId("Marionette:execute", executeFn);
   removeMessageListenerId("Marionette:executeInSandbox", executeInSandboxFn);
-  removeMessageListenerId("Marionette:executeSimpleTest", executeSimpleTestFn);
   removeMessageListenerId("Marionette:singleTap", singleTapFn);
   removeMessageListenerId("Marionette:performActions", performActionsFn);
   removeMessageListenerId("Marionette:releaseActions", releaseActionsFn);
   removeMessageListenerId("Marionette:actionChain", actionChainFn);
   removeMessageListenerId("Marionette:multiAction", multiActionFn);
   removeMessageListenerId("Marionette:get", get);
   removeMessageListenerId("Marionette:waitForPageLoaded", waitForPageLoaded);
   removeMessageListenerId("Marionette:cancelRequest", cancelRequest);
@@ -756,41 +752,16 @@ function* executeInSandbox(script, args,
 
   let res = yield evaluatePromise;
   sendSyncMessage(
       "Marionette:shareData",
       {log: evaluate.toJSON(contentLog.get(), seenEls)});
   return evaluate.toJSON(res, seenEls);
 }
 
-function* executeSimpleTest(script, args, timeout, opts) {
-  opts.timeout = timeout;
-  let win = curContainer.frame;
-
-  let harness = new simpletest.Harness(
-      win,
-      "content",
-      contentLog,
-      timeout,
-      marionetteTestName);
-  let sb = sandbox.createSimpleTest(curContainer.frame, harness);
-  // TODO(ato): Not sure this is needed:
-  sb = sandbox.augment(sb, new logging.Adapter(contentLog));
-
-  let wargs = evaluate.fromJSON(
-      args, seenEls, curContainer.frame, curContainer.shadowRoot);
-  let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
-
-  let res = yield evaluatePromise;
-  sendSyncMessage(
-      "Marionette:shareData",
-      {log: evaluate.toJSON(contentLog.get(), seenEls)});
-  return evaluate.toJSON(res, seenEls);
-}
-
 /**
  * Sets the test name, used in logging messages.
  */
 function setTestName(msg) {
   marionetteTestName = msg.json.value;
   sendOk(msg.json.command_id);
 }
 
deleted file mode 100644
--- a/testing/marionette/simpletest.js
+++ /dev/null
@@ -1,208 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-"use strict";
-
-const {utils: Cu} = Components;
-
-Cu.import("chrome://marionette/content/error.js");
-
-this.EXPORTED_SYMBOLS = ["simpletest"];
-
-this.simpletest = {};
-
-/**
- * The simpletest harness, exposed in the script evaluation sandbox.
- */
-simpletest.Harness = class {
-  constructor(window, context, contentLogger, timeout, testName) {
-    this.window = window;
-    this.tests = [];
-    this.logger = contentLogger;
-    this.context = context;
-    this.timeout = timeout;
-    this.testName = testName;
-    this.TEST_UNEXPECTED_FAIL = "TEST-UNEXPECTED-FAIL";
-    this.TEST_UNEXPECTED_PASS = "TEST-UNEXPECTED-PASS";
-    this.TEST_PASS = "TEST-PASS";
-    this.TEST_KNOWN_FAIL = "TEST-KNOWN-FAIL";
-  }
-
-  get exports() {
-    return new Map([
-      ["ok", this.ok.bind(this)],
-      ["is", this.is.bind(this)],
-      ["isnot", this.isnot.bind(this)],
-      ["todo", this.todo.bind(this)],
-      ["log", this.log.bind(this)],
-      ["getLogs", this.getLogs.bind(this)],
-      ["generate_results", this.generate_results.bind(this)],
-      ["waitFor", this.waitFor.bind(this)],
-      ["TEST_PASS", this.TEST_PASS],
-      ["TEST_KNOWN_FAIL", this.TEST_KNOWN_FAIL],
-      ["TEST_UNEXPECTED_FAIL", this.TEST_UNEXPECTED_FAIL],
-      ["TEST_UNEXPECTED_PASS", this.TEST_UNEXPECTED_PASS],
-    ]);
-  }
-
-  addTest(condition, name, passString, failString, diag, state) {
-    let test = {
-      result: !!condition,
-      name: name,
-      diag: diag,
-      state: state
-    };
-    this.logResult(
-        test,
-        typeof passString == "undefined" ? this.TEST_PASS : passString,
-        typeof failString == "undefined" ? this.TEST_UNEXPECTED_FAIL : failString);
-    this.tests.push(test);
-  }
-
-  ok(condition, name, passString, failString) {
-    let diag = `${this.repr(condition)} was ${!!condition}, expected true`;
-    this.addTest(condition, name, passString, failString, diag);
-  }
-
-  is(a, b, name, passString, failString) {
-    let pass = (a == b);
-    let diag = pass ? this.repr(a) + " should equal " + this.repr(b)
-                    : "got " + this.repr(a) + ", expected " + this.repr(b);
-    this.addTest(pass, name, passString, failString, diag);
-  }
-
-  isnot(a, b, name, passString, failString) {
-    let pass = (a != b);
-    let diag = pass ? this.repr(a) + " should not equal " + this.repr(b)
-                    : "didn't expect " + this.repr(a) + ", but got it";
-    this.addTest(pass, name, passString, failString, diag);
-  }
-
-  todo(condition, name, passString, failString) {
-    let diag = this.repr(condition) + " was expected false";
-    this.addTest(!condition,
-                 name,
-                 typeof(passString) == "undefined" ? this.TEST_KNOWN_FAIL : passString,
-                 typeof(failString) == "undefined" ? this.TEST_UNEXPECTED_FAIL : failString,
-                 diag,
-                 "todo");
-  }
-
-  log(msg, level) {
-    dump("MARIONETTE LOG: " + (level ? level : "INFO") + ": " + msg + "\n");
-    if (this.logger) {
-      this.logger.log(msg, level);
-    }
-  }
-
-  // TODO(ato): Suspect this isn't used anywhere
-  getLogs() {
-    if (this.logger) {
-      return this.logger.get();
-    }
-  }
-
-  generate_results() {
-    let passed = 0;
-    let failures = [];
-    let expectedFailures = [];
-    let unexpectedSuccesses = [];
-    for (let i in this.tests) {
-      let isTodo = (this.tests[i].state == "todo");
-      if(this.tests[i].result) {
-        if (isTodo) {
-          expectedFailures.push({'name': this.tests[i].name, 'diag': this.tests[i].diag});
-        }
-        else {
-          passed++;
-        }
-      }
-      else {
-        if (isTodo) {
-          unexpectedSuccesses.push({'name': this.tests[i].name, 'diag': this.tests[i].diag});
-        }
-        else {
-          failures.push({'name': this.tests[i].name, 'diag': this.tests[i].diag});
-        }
-      }
-    }
-    // Reset state in case this object is reused for more tests.
-    this.tests = [];
-    return {
-      passed: passed,
-      failures: failures,
-      expectedFailures: expectedFailures,
-      unexpectedSuccesses: unexpectedSuccesses,
-    };
-  }
-
-  logToFile(file) {
-    //TODO
-  }
-
-  logResult(test, passString, failString) {
-    //TODO: dump to file
-    let resultString = test.result ? passString : failString;
-    let diagnostic = test.name + (test.diag ? " - " + test.diag : "");
-    let msg = resultString + " | " + this.testName + " | " + diagnostic;
-    dump("MARIONETTE TEST RESULT:" + msg + "\n");
-  }
-
-  repr(o) {
-    if (typeof o == "undefined") {
-      return "undefined";
-    } else if (o === null) {
-      return "null";
-    }
-
-    try {
-        if (typeof o.__repr__ == "function") {
-          return o.__repr__();
-        } else if (typeof o.repr == "function" && o.repr !== arguments.callee) {
-          return o.repr();
-        }
-   } catch (e) {}
-
-   try {
-      if (typeof o.NAME === "string" &&
-          (o.toString === Function.prototype.toString || o.toString === Object.prototype.toString)) {
-        return o.NAME;
-      }
-    } catch (e) {}
-
-    let ostring;
-    try {
-      ostring = (o + "");
-    } catch (e) {
-      return "[" + typeof(o) + "]";
-    }
-
-    if (typeof o == "function") {
-      o = ostring.replace(/^\s+/, "");
-      let idx = o.indexOf("{");
-      if (idx != -1) {
-        o = o.substr(0, idx) + "{...}";
-      }
-    }
-    return ostring;
-  }
-
-  waitFor(callback, test, timeout) {
-    if (test()) {
-      callback();
-      return;
-    }
-
-    let now = new Date();
-    let deadline = (timeout instanceof Date) ? timeout :
-        new Date(now.valueOf() + (typeof timeout == "undefined" ? this.timeout : timeout));
-    if (deadline <= now) {
-      dump("waitFor timeout: " + test.toString() + "\n");
-      // the script will timeout here, so no need to raise a separate
-      // timeout exception
-      return;
-    }
-    this.window.setTimeout(this.waitFor.bind(this), 100, callback, test, deadline);
-  }
-};