Bug 1330772 - Remove all b2g related code from reftests, r=jmaher
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 12 Jan 2017 16:37:37 -0500
changeset 329305 5e752a0c17ae600803ac04e2910cbdea93b668ea
parent 329304 2c630751958a56e56114867fe4697711e3522ce9
child 329306 671a2f8542cadcf9aad318ab76250a730a03b240
child 329377 8ce511714aad7d3f58fdfa47ad5403371ae36ec1
push id31203
push userkwierso@gmail.com
push dateFri, 13 Jan 2017 23:28:17 +0000
treeherdermozilla-central@671a2f8542ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1330772
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1330772 - Remove all b2g related code from reftests, r=jmaher MozReview-Commit-ID: HY1XbcliTNA
build/mobile/b2gautomation.py
layout/reftests/forms/input/datetime/reftest-stylo.list
layout/reftests/forms/input/datetime/reftest.list
layout/tools/reftest/b2g_start_script.js
layout/tools/reftest/bootstrap.js
layout/tools/reftest/gaia_lock_screen.js
layout/tools/reftest/jar.mn
layout/tools/reftest/mach_commands.py
layout/tools/reftest/moz.build
layout/tools/reftest/output.py
layout/tools/reftest/reftest-content.js
layout/tools/reftest/reftest.jsm
layout/tools/reftest/reftestcommandline.py
layout/tools/reftest/runreftest.py
layout/tools/reftest/runreftestb2g.py
layout/tools/reftest/runreftestmulet.py
testing/testsuite-targets.mk
deleted file mode 100644
--- a/build/mobile/b2gautomation.py
+++ /dev/null
@@ -1,455 +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/.
-
-import datetime
-import mozcrash
-import threading
-import os
-import posixpath
-import Queue
-import re
-import shutil
-import signal
-import tempfile
-import time
-import traceback
-import zipfile
-
-from automation import Automation
-from mozlog import get_default_logger
-from mozprocess import ProcessHandlerMixin
-
-
-class StdOutProc(ProcessHandlerMixin):
-    """Process handler for b2g which puts all output in a Queue.
-    """
-
-    def __init__(self, cmd, queue, **kwargs):
-        self.queue = queue
-        kwargs.setdefault('processOutputLine', []).append(self.handle_output)
-        ProcessHandlerMixin.__init__(self, cmd, **kwargs)
-
-    def handle_output(self, line):
-        self.queue.put_nowait(line)
-
-
-class B2GRemoteAutomation(Automation):
-    _devicemanager = None
-
-    def __init__(self, deviceManager, appName='', remoteLog=None,
-                 marionette=None):
-        self._devicemanager = deviceManager
-        self._appName = appName
-        self._remoteProfile = None
-        self._remoteLog = remoteLog
-        self.marionette = marionette
-        self._is_emulator = False
-        self.test_script = None
-        self.test_script_args = None
-
-        # Default our product to b2g
-        self._product = "b2g"
-        self.lastTestSeen = "b2gautomation.py"
-        # Default log finish to mochitest standard
-        self.logFinish = 'INFO SimpleTest FINISHED'
-        Automation.__init__(self)
-
-    def setEmulator(self, is_emulator):
-        self._is_emulator = is_emulator
-
-    def setDeviceManager(self, deviceManager):
-        self._devicemanager = deviceManager
-
-    def setAppName(self, appName):
-        self._appName = appName
-
-    def setRemoteProfile(self, remoteProfile):
-        self._remoteProfile = remoteProfile
-
-    def setProduct(self, product):
-        self._product = product
-
-    def setRemoteLog(self, logfile):
-        self._remoteLog = logfile
-
-    def getExtensionIDFromRDF(self, rdfSource):
-        """
-        Retrieves the extension id from an install.rdf file (or string).
-        """
-        from xml.dom.minidom import parse, parseString, Node
-
-        if isinstance(rdfSource, file):
-            document = parse(rdfSource)
-        else:
-            document = parseString(rdfSource)
-
-        # Find the <em:id> element. There can be multiple <em:id> tags
-        # within <em:targetApplication> tags, so we have to check this way.
-        for rdfChild in document.documentElement.childNodes:
-            if rdfChild.nodeType == Node.ELEMENT_NODE and rdfChild.tagName == "Description":
-                for descChild in rdfChild.childNodes:
-                    if descChild.nodeType == Node.ELEMENT_NODE and descChild.tagName == "em:id":
-                        return descChild.childNodes[0].data
-        return None
-
-    def installExtension(self, extensionSource, profileDir, extensionID=None):
-        # Bug 827504 - installing special-powers extension separately causes problems in B2G
-        if extensionID != "special-powers@mozilla.org":
-            if not os.path.isdir(profileDir):
-              self.log.info("INFO | automation.py | Cannot install extension, invalid profileDir at: %s", profileDir)
-              return
-
-            installRDFFilename = "install.rdf"
-
-            extensionsRootDir = os.path.join(profileDir, "extensions", "staged")
-            if not os.path.isdir(extensionsRootDir):
-              os.makedirs(extensionsRootDir)
-
-            if os.path.isfile(extensionSource):
-              reader = zipfile.ZipFile(extensionSource, "r")
-
-              for filename in reader.namelist():
-                # Sanity check the zip file.
-                if os.path.isabs(filename):
-                  self.log.info("INFO | automation.py | Cannot install extension, bad files in xpi")
-                  return
-
-                # We may need to dig the extensionID out of the zip file...
-                if extensionID is None and filename == installRDFFilename:
-                  extensionID = self.getExtensionIDFromRDF(reader.read(filename))
-
-              # We must know the extensionID now.
-              if extensionID is None:
-                self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
-                return
-
-              # Make the extension directory.
-              extensionDir = os.path.join(extensionsRootDir, extensionID)
-              os.mkdir(extensionDir)
-
-              # Extract all files.
-              reader.extractall(extensionDir)
-
-            elif os.path.isdir(extensionSource):
-              if extensionID is None:
-                filename = os.path.join(extensionSource, installRDFFilename)
-                if os.path.isfile(filename):
-                  with open(filename, "r") as installRDF:
-                    extensionID = self.getExtensionIDFromRDF(installRDF)
-
-                if extensionID is None:
-                  self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
-                  return
-
-              # Copy extension tree into its own directory.
-              # "destination directory must not already exist".
-              shutil.copytree(extensionSource, os.path.join(extensionsRootDir, extensionID))
-
-            else:
-              self.log.info("INFO | automation.py | Cannot install extension, invalid extensionSource at: %s", extensionSource)
-
-    # Set up what we need for the remote environment
-    def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False):
-        # Because we are running remote, we don't want to mimic the local env
-        # so no copying of os.environ
-        if env is None:
-            env = {}
-
-        if crashreporter:
-            env['MOZ_CRASHREPORTER'] = '1'
-            env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
-
-        # We always hide the results table in B2G; it's much slower if we don't.
-        env['MOZ_HIDE_RESULTS_TABLE'] = '1'
-        return env
-
-    def waitForNet(self):
-        active = False
-        time_out = 0
-        while not active and time_out < 40:
-            data = self._devicemanager._runCmd(['shell', '/system/bin/netcfg']).stdout.readlines()
-            data.pop(0)
-            for line in data:
-                if (re.search(r'UP\s+(?:[0-9]{1,3}\.){3}[0-9]{1,3}', line)):
-                    active = True
-                    break
-            time_out += 1
-            time.sleep(1)
-        return active
-
-    def checkForCrashes(self, directory, symbolsPath):
-        crashed = False
-        remote_dump_dir = self._remoteProfile + '/minidumps'
-        print "checking for crashes in '%s'" % remote_dump_dir
-        if self._devicemanager.dirExists(remote_dump_dir):
-            local_dump_dir = tempfile.mkdtemp()
-            self._devicemanager.getDirectory(remote_dump_dir, local_dump_dir)
-            try:
-                logger = get_default_logger()
-                if logger is not None:
-                    crashed = mozcrash.log_crashes(logger, local_dump_dir, symbolsPath, test=self.lastTestSeen)
-                else:
-                    crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
-            except:
-                traceback.print_exc()
-            finally:
-                shutil.rmtree(local_dump_dir)
-                self._devicemanager.removeDir(remote_dump_dir)
-        return crashed
-
-    def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
-        # if remote profile is specified, use that instead
-        if (self._remoteProfile):
-            profileDir = self._remoteProfile
-
-        cmd, args = Automation.buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs)
-
-        return app, args
-
-    def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime,
-                      debuggerInfo, symbolsPath, outputHandler=None):
-        """ Wait for tests to finish (as evidenced by a signature string
-            in logcat), or for a given amount of time to elapse with no
-            output.
-        """
-        timeout = timeout or 120
-        while True:
-            lines = proc.getStdoutLines(timeout)
-            if lines:
-                currentlog = '\n'.join(lines)
-
-                if outputHandler:
-                    for line in lines:
-                        outputHandler(line)
-                else:
-                    print(currentlog)
-
-                # Match the test filepath from the last TEST-START line found in the new
-                # log content. These lines are in the form:
-                # ... INFO TEST-START | /filepath/we/wish/to/capture.html\n
-                testStartFilenames = re.findall(r"TEST-START \| ([^\s]*)", currentlog)
-                if testStartFilenames:
-                    self.lastTestSeen = testStartFilenames[-1]
-                if (outputHandler and outputHandler.suite_finished) or (
-                        hasattr(self, 'logFinish') and self.logFinish in currentlog):
-                    return 0
-            else:
-                self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed "
-                              "out after %d seconds with no output",
-                              self.lastTestSeen, int(timeout))
-                self._devicemanager.killProcess('/system/b2g/b2g', sig=signal.SIGABRT)
-
-                timeout = 10 # seconds
-                starttime = datetime.datetime.now()
-                while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout):
-                    if not self._devicemanager.processExist('/system/b2g/b2g'):
-                        break
-                    time.sleep(1)
-                else:
-                    print "timed out after %d seconds waiting for b2g process to exit" % timeout
-                    return 1
-
-                self.checkForCrashes(None, symbolsPath)
-                return 1
-
-    def getDeviceStatus(self, serial=None):
-        # Get the current status of the device.  If we know the device
-        # serial number, we look for that, otherwise we use the (presumably
-        # only) device shown in 'adb devices'.
-        serial = serial or self._devicemanager._deviceSerial
-        status = 'unknown'
-
-        for line in self._devicemanager._runCmd(['devices']).stdout.readlines():
-            result = re.match('(.*?)\t(.*)', line)
-            if result:
-                thisSerial = result.group(1)
-                if not serial or thisSerial == serial:
-                    serial = thisSerial
-                    status = result.group(2)
-
-        return (serial, status)
-
-    def restartB2G(self):
-        # TODO hangs in subprocess.Popen without this delay
-        time.sleep(5)
-        self._devicemanager._checkCmd(['shell', 'stop', 'b2g'])
-        # Wait for a bit to make sure B2G has completely shut down.
-        time.sleep(10)
-        self._devicemanager._checkCmd(['shell', 'start', 'b2g'])
-        if self._is_emulator:
-            self.marionette.emulator.wait_for_port(self.marionette.port)
-
-    def rebootDevice(self):
-        # find device's current status and serial number
-        serial, status = self.getDeviceStatus()
-
-        # reboot!
-        self._devicemanager._runCmd(['shell', '/system/bin/reboot'])
-
-        # The above command can return while adb still thinks the device is
-        # connected, so wait a little bit for it to disconnect from adb.
-        time.sleep(10)
-
-        # wait for device to come back to previous status
-        print 'waiting for device to come back online after reboot'
-        start = time.time()
-        rserial, rstatus = self.getDeviceStatus(serial)
-        while rstatus != 'device':
-            if time.time() - start > 120:
-                # device hasn't come back online in 2 minutes, something's wrong
-                raise Exception("Device %s (status: %s) not back online after reboot" % (serial, rstatus))
-            time.sleep(5)
-            rserial, rstatus = self.getDeviceStatus(serial)
-        print 'device:', serial, 'status:', rstatus
-
-    def Process(self, cmd, stdout=None, stderr=None, env=None, cwd=None):
-        # On a desktop or fennec run, the Process method invokes a gecko
-        # process in which to the tests.  For B2G, we simply
-        # reboot the device (which was configured with a test profile
-        # already), wait for B2G to start up, and then navigate to the
-        # test url using Marionette.  There doesn't seem to be any way
-        # to pass env variables into the B2G process, but this doesn't
-        # seem to matter.
-
-        # reboot device so it starts up with the mochitest profile
-        # XXX:  We could potentially use 'stop b2g' + 'start b2g' to achieve
-        # a similar effect; will see which is more stable while attempting
-        # to bring up the continuous integration.
-        if not self._is_emulator:
-            self.rebootDevice()
-            time.sleep(5)
-            #wait for wlan to come up
-            if not self.waitForNet():
-                raise Exception("network did not come up, please configure the network" +
-                                " prior to running before running the automation framework")
-
-        # stop b2g
-        self._devicemanager._runCmd(['shell', 'stop', 'b2g'])
-        time.sleep(5)
-
-        # For some reason user.js in the profile doesn't get picked up.
-        # Manually copy it over to prefs.js. See bug 1009730 for more details.
-        self._devicemanager.moveTree(posixpath.join(self._remoteProfile, 'user.js'),
-                                     posixpath.join(self._remoteProfile, 'prefs.js'))
-
-        # relaunch b2g inside b2g instance
-        instance = self.B2GInstance(self._devicemanager, env=env)
-
-        time.sleep(5)
-
-        # Set up port forwarding again for Marionette, since any that
-        # existed previously got wiped out by the reboot.
-        if not self._is_emulator:
-            self._devicemanager._checkCmd(['forward',
-                                           'tcp:%s' % self.marionette.port,
-                                           'tcp:%s' % self.marionette.port])
-
-        if self._is_emulator:
-            self.marionette.emulator.wait_for_port(self.marionette.port)
-        else:
-            time.sleep(5)
-
-        # start a marionette session
-        session = self.marionette.start_session()
-        if 'b2g' not in session:
-            raise Exception("bad session value %s returned by start_session" % session)
-
-        with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
-            self.marionette.execute_script("""
-                let SECURITY_PREF = "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer";
-                Components.utils.import("resource://gre/modules/Services.jsm");
-                Services.prefs.setBoolPref(SECURITY_PREF, true);
-
-                if (!testUtils.hasOwnProperty("specialPowersObserver")) {
-                  let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                    .getService(Components.interfaces.mozIJSSubScriptLoader);
-                  loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.jsm",
-                    testUtils);
-                  testUtils.specialPowersObserver = new testUtils.SpecialPowersObserver();
-                  testUtils.specialPowersObserver.init();
-                }
-                """)
-
-            # run the script that starts the tests
-            if self.test_script:
-                if os.path.isfile(self.test_script):
-                    script = open(self.test_script, 'r')
-                    self.marionette.execute_script(script.read(), script_args=self.test_script_args)
-                    script.close()
-                elif isinstance(self.test_script, basestring):
-                    self.marionette.execute_script(self.test_script, script_args=self.test_script_args)
-            else:
-                # assumes the tests are started on startup automatically
-                pass
-
-        return instance
-
-    # be careful here as this inner class doesn't have access to outer class members
-    class B2GInstance(object):
-        """Represents a B2G instance running on a device, and exposes
-           some process-like methods/properties that are expected by the
-           automation.
-        """
-
-        def __init__(self, dm, env=None):
-            self.dm = dm
-            self.env = env or {}
-            self.stdout_proc = None
-            self.queue = Queue.Queue()
-
-            # Launch b2g in a separate thread, and dump all output lines
-            # into a queue.  The lines in this queue are
-            # retrieved and returned by accessing the stdout property of
-            # this class.
-            cmd = [self.dm._adbPath]
-            if self.dm._deviceSerial:
-                cmd.extend(['-s', self.dm._deviceSerial])
-            cmd.append('shell')
-            for k, v in self.env.iteritems():
-                cmd.append("%s=%s" % (k, v))
-            cmd.append('/system/bin/b2g.sh')
-            proc = threading.Thread(target=self._save_stdout_proc, args=(cmd, self.queue))
-            proc.daemon = True
-            proc.start()
-
-        def _save_stdout_proc(self, cmd, queue):
-            self.stdout_proc = StdOutProc(cmd, queue)
-            self.stdout_proc.run()
-            if hasattr(self.stdout_proc, 'processOutput'):
-                self.stdout_proc.processOutput()
-            self.stdout_proc.wait()
-            self.stdout_proc = None
-
-        @property
-        def pid(self):
-            # a dummy value to make the automation happy
-            return 0
-
-        def getStdoutLines(self, timeout):
-            # Return any lines in the queue used by the
-            # b2g process handler.
-            lines = []
-            # get all of the lines that are currently available
-            while True:
-                try:
-                    lines.append(self.queue.get_nowait())
-                except Queue.Empty:
-                    break
-
-            # wait 'timeout' for any additional lines
-            if not lines:
-                try:
-                    lines.append(self.queue.get(True, timeout))
-                except Queue.Empty:
-                    pass
-            return lines
-
-        def wait(self, timeout=None):
-            # this should never happen
-            raise Exception("'wait' called on B2GInstance")
-
-        def kill(self):
-            # this should never happen
-            raise Exception("'kill' called on B2GInstance")
-
--- a/layout/reftests/forms/input/datetime/reftest-stylo.list
+++ b/layout/reftests/forms/input/datetime/reftest-stylo.list
@@ -1,14 +1,14 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 default-preferences pref(dom.forms.datetime,true)
 
-# not valid on Android/B2G where type=time looks like type=text
+# not valid on Android where type=time looks like type=text
 # == time-simple-unthemed.html time-simple-unthemed.html
 # == time-large-font.html time-large-font.html
 # == time-width-height.html time-width-height.html
 # == time-border.html time-border.html
-# only valid on Android/B2G where type=number looks the same as type=text
+# only valid on Android where type=number looks the same as type=text
 # == time-simple-unthemed.html time-simple-unthemed.html
 
 # type change
 # == to-time-from-other-type-unthemed.html to-time-from-other-type-unthemed.html
 # == from-time-to-other-type-unthemed.html from-time-to-other-type-unthemed.html
--- a/layout/reftests/forms/input/datetime/reftest.list
+++ b/layout/reftests/forms/input/datetime/reftest.list
@@ -1,13 +1,13 @@
 default-preferences pref(dom.forms.datetime,true)
 
-# not valid on Android/B2G where type=time looks like type=text
-skip-if(Android||B2G||Mulet) != time-simple-unthemed.html time-simple-unthemed-ref.html
-skip-if(Android||B2G||Mulet) != time-large-font.html time-basic.html
-skip-if(Android||B2G||Mulet) != time-width-height.html time-basic.html
-skip-if(Android||B2G||Mulet) != time-border.html time-basic.html
-# only valid on Android/B2G where type=number looks the same as type=text
-skip-if(!Android&&!B2G&&!Mulet) == time-simple-unthemed.html time-simple-unthemed-ref.html
+# not valid on Android where type=time looks like type=text
+skip-if(Android) != time-simple-unthemed.html time-simple-unthemed-ref.html
+skip-if(Android) != time-large-font.html time-basic.html
+skip-if(Android) != time-width-height.html time-basic.html
+skip-if(Android) != time-border.html time-basic.html
+# only valid on Android where type=number looks the same as type=text
+skip-if(!Android) == time-simple-unthemed.html time-simple-unthemed-ref.html
 
 # type change
-skip-if(Android||B2G||Mulet) == to-time-from-other-type-unthemed.html time-simple-unthemed.html
-skip-if(Android||B2G||Mulet) == from-time-to-other-type-unthemed.html from-time-to-other-type-unthemed-ref.html
+skip-if(Android) == to-time-from-other-type-unthemed.html time-simple-unthemed.html
+skip-if(Android) == from-time-to-other-type-unthemed.html from-time-to-other-type-unthemed-ref.html
deleted file mode 100644
--- a/layout/tools/reftest/b2g_start_script.js
+++ /dev/null
@@ -1,57 +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/. */
-
-const { utils: Cu, classes: Cc, interfaces: Ci } = Components;
-
-function setPermissions() {
-  if (__webDriverArguments.length < 2) {
-    return;
-  }
-
-  let serverAddr = __webDriverArguments[0];
-  let serverPort = __webDriverArguments[1];
-  let perms = Cc["@mozilla.org/permissionmanager;1"]
-              .getService(Ci.nsIPermissionManager);
-  let ioService = Cc["@mozilla.org/network/io-service;1"]
-                  .getService(Ci.nsIIOService);
-  let uri = ioService.newURI("http://" + serverAddr + ":" + serverPort);
-  perms.add(uri, "allowXULXBL", Ci.nsIPermissionManager.ALLOW_ACTION);
-}
-
-var cm = Cc["@mozilla.org/categorymanager;1"]
-           .getService(Ci.nsICategoryManager);
-
-// Disable update timers that cause b2g failures.
-if (cm) {
-  cm.deleteCategoryEntry("update-timer", "nsUpdateService", false);
-}
-
-// Load into any existing windows
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
-            .getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow('');
-
-setPermissions();
-
-// Loading this into the global namespace causes intermittent failures.
-// See bug 882888 for more details.
-var reftest = {};
-Cu.import("chrome://reftest/content/reftest.jsm", reftest);
-
-// Prevent display off during testing.
-navigator.mozPower.screenEnabled = true;
-var settingLock = navigator.mozSettings.createLock();
-var settingResult = settingLock.set({
-  'screen.timeout': 0
-});
-settingResult.onsuccess = function () {
-  dump("Set screen.time to 0\n");
-  // Start the reftests
-  reftest.OnRefTestLoad(win);
-}
-settingResult.onerror = function () {
-  dump("Change screen.time failed\n");
-  // Start the reftests
-  reftest.OnRefTestLoad(win);
-}
--- a/layout/tools/reftest/bootstrap.js
+++ b/layout/tools/reftest/bootstrap.js
@@ -28,21 +28,16 @@ var WindowListener = {
         // Add setTimeout here because windows.innerWidth/Height are not set yet.
         win.setTimeout(function() {OnRefTestLoad(win);}, 0);
       });
     }, false);
   }
 };
 
 function startup(data, reason) {
-  // b2g is bootstrapped by b2g_start_script.js
-  if (Services.appinfo.widgetToolkit == "gonk") {
-    return;
-  }
-
   if (Services.appinfo.OS == "Android") {
     Cm.addBootstrappedManifestLocation(data.installPath);
     Services.wm.addListener(WindowListener);
     return;
   }
 
   let orig = Services.wm.getMostRecentWindow("navigator:browser");
 
@@ -61,20 +56,16 @@ function startup(data, reason) {
 
     dummy.focus();
     wwatch.openWindow(null, "chrome://reftest/content/reftest.xul", "_blank",
                       "chrome,dialog=no,all", {});
   };
 }
 
 function shutdown(data, reason) {
-  if (Services.appinfo.widgetToolkit == "gonk") {
-    return;
-  }
-
   if (Services.appinfo.OS == "Android") {
     Services.wm.removeListener(WindowListener);
     Cm.removedBootstrappedManifestLocation(data.installPath);
     OnRefTestUnload();
     Cu.unload("chrome://reftest/content/reftest.jsm");
   }
 }
 
deleted file mode 100644
--- a/layout/tools/reftest/gaia_lock_screen.js
+++ /dev/null
@@ -1,60 +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/. */
-
-// NOTE: This code was forked from:
-// https://github.com/mozilla-b2g/gaia/blob/master/tests/atoms/gaia_lock_screen.js
-
-'use strict';
-/* globals waitFor, finish */
-/* exported GaiaLockScreen */
-
-var GaiaLockScreen = {
-
-  unlock: function(forcibly) {
-    let setlock = window.wrappedJSObject.SettingsListener.getSettingsLock();
-    let service = window.wrappedJSObject.Service;
-    let obj = {'screen.timeout': 0};
-    setlock.set(obj);
-
-    waitFor(
-      function() {
-        service.request('unlock', { forcibly: forcibly });
-        waitFor(
-          function() {
-            finish(service.locked);
-          },
-          function() {
-            return !service.locked;
-          }
-        );
-      },
-      function() {
-        return !!service;
-      }
-    );
-  },
-
-  lock: function(forcibly) {
-    let service = window.wrappedJSObject.Service;
-    let setlock = window.wrappedJSObject.SettingsListener.getSettingsLock();
-    let obj = {'screen.timeout': 0};
-    setlock.set(obj);
-    waitFor(
-      function() {
-      service.request('lock', { forcibly: forcibly });
-        waitFor(
-          function() {
-            finish(!service.locked);
-          },
-          function() {
-            return service.locked;
-          }
-        );
-      },
-      function() {
-        return !!service;
-      }
-    );
-  }
-};
--- a/layout/tools/reftest/jar.mn
+++ b/layout/tools/reftest/jar.mn
@@ -1,7 +1,7 @@
 reftest.jar:
 % content reftest %content/
-*  content/reftest-content.js (reftest-content.js)
+  content/reftest-content.js (reftest-content.js)
   content/httpd.jsm (../../../netwerk/test/httpserver/httpd.js)
   content/StructuredLog.jsm (../../../testing/modules/StructuredLog.jsm)
 *  content/reftest.jsm (reftest.jsm)
   content/reftest.xul (reftest.xul)
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -2,70 +2,31 @@
 # 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 __future__ import absolute_import, unicode_literals
 
 import os
 import re
 import sys
-import warnings
-import which
 from argparse import Namespace
 
 from mozbuild.base import (
     MachCommandBase,
     MachCommandConditions as conditions,
     MozbuildObject,
 )
 
 from mach.decorators import (
     CommandProvider,
     Command,
 )
 
 import reftestcommandline
 
-ADB_NOT_FOUND = '''
-The %s command requires the adb binary to be on your path.
-
-If you have a B2G build, this can be found in
-'%s/out/host/<platform>/bin'.
-'''.lstrip()
-
-GAIA_PROFILE_NOT_FOUND = '''
-The reftest command requires a non-debug gaia profile on Mulet.
-Either pass in --profile, or set the GAIA_PROFILE environment variable.
-
-If you do not have a non-debug gaia profile, you can build one:
-    $ git clone https://github.com/mozilla-b2g/gaia
-    $ cd gaia
-    $ make
-
-The profile should be generated in a directory called 'profile'.
-'''.lstrip()
-
-GAIA_PROFILE_IS_DEBUG = '''
-The reftest command requires a non-debug gaia profile on Mulet.
-The specified profile, %s, is a debug profile.
-
-If you do not have a non-debug gaia profile, you can build one:
-    $ git clone https://github.com/mozilla-b2g/gaia
-    $ cd gaia
-    $ make
-
-The profile should be generated in a directory called 'profile'.
-'''.lstrip()
-
-MARIONETTE_DISABLED = '''
-The reftest command requires a marionette enabled build on Mulet.
-
-Add 'ac_add_options --enable-marionette' to your mozconfig file and re-build the application.
-Your currently active mozconfig is %s.
-'''.lstrip()
 
 parser = None
 
 
 class ReftestRunner(MozbuildObject):
     """Easily run reftests.
 
     This currently contains just the basics for running reftests. We may want
@@ -95,90 +56,16 @@ class ReftestRunner(MozbuildObject):
                 "crashtest": os.path.join('layout', 'crashtest'),
             }[args.suite]
             args.tests = [test_subdir]
 
         tests = os.path.join(self.reftest_dir, 'tests')
         if not os.path.isdir(tests):
             os.symlink(self.topsrcdir, tests)
 
-    def run_b2g_test(self, b2g_home=None, xre_path=None, **kwargs):
-        """Runs a b2g reftest.
-
-        filter is a regular expression (in JS syntax, as could be passed to the
-        RegExp constructor) to select which reftests to run from the manifest.
-
-        tests is a list of paths. It can be a relative path from the
-        top source directory, an absolute filename, or a directory containing
-        test files.
-
-        suite is the type of reftest to run. It can be one of ('reftest',
-        'crashtest').
-        """
-        args = Namespace(**kwargs)
-        if args.suite not in ('reftest', 'crashtest'):
-            raise Exception('None or unrecognized reftest suite type.')
-
-        self._setup_objdir(args)
-        import runreftestb2g
-
-        for i, path in enumerate(args.tests):
-            # Non-absolute paths are relative to the packaged directory, which
-            # has an extra tests/ at the start
-            if os.path.exists(os.path.abspath(path)):
-                path = os.path.relpath(path, os.path.join(self.topsrcdir))
-            args.tests[i] = os.path.join('tests', path)
-
-        try:
-            which.which('adb')
-        except which.WhichError:
-            # TODO Find adb automatically if it isn't on the path
-            raise Exception(ADB_NOT_FOUND % ('%s-remote' % args.suite, b2g_home))
-
-        args.b2gPath = b2g_home
-        args.logdir = self.reftest_dir
-        args.httpdPath = os.path.join(self.topsrcdir, 'netwerk', 'test', 'httpserver')
-        args.xrePath = xre_path
-        args.ignoreWindowSize = True
-
-        return runreftestb2g.run_test_harness(parser, args)
-
-    def run_mulet_test(self, **kwargs):
-        """Runs a mulet reftest."""
-        args = Namespace(**kwargs)
-        self._setup_objdir(args)
-
-        import runreftestmulet
-
-        if self.substs.get('ENABLE_MARIONETTE') != '1':
-            print(MARIONETTE_DISABLED % self.mozconfig['path'])
-            return 1
-
-        if not args.profile:
-            gaia_profile = os.environ.get('GAIA_PROFILE')
-            if not gaia_profile:
-                print(GAIA_PROFILE_NOT_FOUND)
-                return 1
-            args.profile = gaia_profile
-
-        if os.path.isfile(os.path.join(args.profile, 'extensions',
-                                       'httpd@gaiamobile.org')):
-            print(GAIA_PROFILE_IS_DEBUG % args.profile)
-            return 1
-
-        args.app = self.get_binary_path()
-        args.mulet = True
-
-        if not args.app.endswith('-bin'):
-            args.app = '%s-bin' % args.app
-        if not os.path.isfile(args.app):
-            args.app = args.app[:-len('-bin')]
-
-        return runreftestmulet.run_test_harness(parser, args)
-
     def run_desktop_test(self, **kwargs):
         """Runs a reftest, in desktop Firefox."""
         import runreftest
 
         args = Namespace(**kwargs)
         if args.suite not in ('reftest', 'crashtest', 'jstestbrowser'):
             raise Exception('None or unrecognized reftest suite type.')
 
@@ -296,18 +183,16 @@ def process_test_objects(kwargs):
 
 
 def get_parser():
     global parser
     here = os.path.abspath(os.path.dirname(__file__))
     build_obj = MozbuildObject.from_environment(cwd=here)
     if conditions.is_android(build_obj):
         parser = reftestcommandline.RemoteArgumentsParser()
-    elif conditions.is_mulet(build_obj):
-        parser = reftestcommandline.B2GArgumentParser()
     else:
         parser = reftestcommandline.DesktopArgumentsParser()
     return parser
 
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     @Command('reftest',
@@ -339,55 +224,9 @@ class MachCommands(MachCommandBase):
 
     def _run_reftest(self, **kwargs):
         process_test_objects(kwargs)
         reftest = self._spawn(ReftestRunner)
         if conditions.is_android(self):
             from mozrunner.devices.android_device import verify_android_device
             verify_android_device(self, install=True, xre=True)
             return reftest.run_android_test(**kwargs)
-        elif conditions.is_mulet(self):
-            return reftest.run_mulet_test(**kwargs)
         return reftest.run_desktop_test(**kwargs)
-
-
-# TODO For now b2g commands will only work with the emulator,
-# they should be modified to work with all devices.
-def is_emulator(cls):
-    """Emulator needs to be configured."""
-    return cls.device_name.startswith('emulator')
-
-
-@CommandProvider
-class B2GCommands(MachCommandBase):
-    def __init__(self, context):
-        MachCommandBase.__init__(self, context)
-
-        for attr in ('b2g_home', 'xre_path', 'device_name'):
-            setattr(self, attr, getattr(context, attr, None))
-
-    @Command('reftest-remote', category='testing',
-             description='Run a remote reftest (b2g layout and graphics correctness, remote device).',
-             conditions=[conditions.is_b2g, is_emulator],
-             parser=get_parser)
-    def run_reftest_remote(self, **kwargs):
-        kwargs["suite"] = "reftest"
-        return self._run_reftest(**kwargs)
-
-    @Command('crashtest-remote', category='testing',
-             description='Run a remote crashtest (Check if b2g crashes on a page, remote device).',
-             conditions=[conditions.is_b2g, is_emulator],
-             parser=get_parser)
-    def run_crashtest_remote(self, test_file, **kwargs):
-        kwargs["suite"] = "crashtest"
-        return self._run_reftest(**kwargs)
-
-    def _run_reftest(self, **kwargs):
-        process_test_objects(kwargs)
-        if self.device_name:
-            if self.device_name.startswith('emulator'):
-                emulator = 'arm'
-                if 'x86' in self.device_name:
-                    emulator = 'x86'
-                kwargs['emulator'] = emulator
-
-        reftest = self._spawn(ReftestRunner)
-        return reftest.run_b2g_test(self.b2g_home, self.xre_path, **kwargs)
--- a/layout/tools/reftest/moz.build
+++ b/layout/tools/reftest/moz.build
@@ -11,28 +11,23 @@ XPI_NAME = 'reftest'
 USE_EXTENSION_MANIFEST = True
 JAR_MANIFESTS += ['jar.mn']
 FINAL_TARGET_PP_FILES += ['install.rdf']
 FINAL_TARGET_FILES += ['bootstrap.js']
 
 GENERATED_FILES += ['automation.py']
 TEST_HARNESS_FILES.reftest += [
     '!automation.py',
-    '/build/mobile/b2gautomation.py',
     '/build/mobile/remoteautomation.py',
     '/build/pgo/server-locations.txt',
     '/testing/mochitest/server.js',
-    'b2g_start_script.js',
-    'gaia_lock_screen.js',
     'mach_test_package_commands.py',
     'output.py',
     'reftest-preferences.js',
     'reftestcommandline.py',
     'remotereftest.py',
     'runreftest.py',
-    'runreftestb2g.py',
-    'runreftestmulet.py',
 ]
 
 TEST_HARNESS_FILES.reftest.chrome += [
     'chrome/binding.xml',
     'chrome/userContent.css',
 ]
--- a/layout/tools/reftest/output.py
+++ b/layout/tools/reftest/output.py
@@ -100,34 +100,29 @@ class OutputHandler(object):
     """Process the output of a process during a test run and translate
     raw data logged from reftest.js to an appropriate structured log action,
     where applicable.
     """
 
     def __init__(self, log, utilityPath, symbolsPath=None):
         self.stack_fixer_function = get_stack_fixer_function(utilityPath, symbolsPath)
         self.log = log
-        # needed for b2gautomation.py
-        self.suite_finished = False
 
     def __call__(self, line):
         # need to return processed messages to appease remoteautomation.py
         if not line.strip():
             return []
 
         try:
             data = json.loads(line)
         except ValueError:
             self.verbatim(line)
             return [line]
 
         if isinstance(data, dict) and 'action' in data:
-            if data['action'] == 'suite_end':
-                self.suite_finished = True
-
             self.log.log_raw(data)
         else:
             self.verbatim(json.dumps(data))
 
         return [data]
 
     def verbatim(self, line):
         if self.stack_fixer_function:
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -95,19 +95,17 @@ function PaintWaitFinishedListener(event
     if (gExplicitPendingPaintCount == 0 &&
         gExplicitPendingPaintsCompleteHook) {
         gExplicitPendingPaintsCompleteHook();
     }
 }
 
 function OnInitialLoad()
 {
-#ifndef REFTEST_B2G
     removeEventListener("load", OnInitialLoad, true);
-#endif
 
     gDebug = CC[DEBUG_CONTRACTID].getService(CI.nsIDebug2);
     var env = CC[ENVIRONMENT_CONTRACTID].getService(CI.nsIEnvironment);
     gVerbose = !!env.get("MOZ_REFTEST_VERBOSE");
 
     RegisterMessageListeners();
 
     var initInfo = SendContentReady();
@@ -177,26 +175,21 @@ function setupFullZoom(contentRootElemen
         contentRootElement.getAttribute('reftest-zoom');
 }
 
 function resetZoom() {
     markupDocumentViewer().fullZoom = 1.0;
 }
 
 function doPrintMode(contentRootElement) {
-#if REFTEST_B2G
-    // nsIPrintSettings not available in B2G
-    return false;
-#else
     // use getAttribute because className works differently in HTML and SVG
     return contentRootElement &&
            contentRootElement.hasAttribute('class') &&
            contentRootElement.getAttribute('class').split(/\s+/)
                              .indexOf("reftest-print") != -1;
-#endif
 }
 
 function setupPrintMode() {
    var PSSVC =
        CC[PRINTSETTINGS_CONTRACTID].getService(CI.nsIPrintSettingsService);
    var ps = PSSVC.newPrintSettings;
    ps.paperWidth = 5;
    ps.paperHeight = 3;
@@ -1157,18 +1150,14 @@ function SendUpdateCanvasForEvent(event,
     // logic here.
     if (!gBrowserIsRemote) {
         sendSyncMessage("reftest:UpdateCanvasForInvalidation", { rects: rects });
     } else {
         SynchronizeForSnapshot(SYNC_ALLOW_DISABLE);
         sendAsyncMessage("reftest:UpdateCanvasForInvalidation", { rects: rects });
     }
 }
-#if REFTEST_B2G
-OnInitialLoad();
-#else
 if (content.document.readyState == "complete") {
   // load event has already fired for content, get started
   OnInitialLoad();
 } else {
   addEventListener("load", OnInitialLoad, true);
 }
-#endif
--- a/layout/tools/reftest/reftest.jsm
+++ b/layout/tools/reftest/reftest.jsm
@@ -58,17 +58,16 @@ var gFocusFilterMode = FOCUS_FILTER_ALL_
 var gCompareStyloToGecko = false;
 
 // "<!--CLEAR-->"
 const BLANK_URL_FOR_CLEARING = "data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E";
 
 var gBrowser;
 // Are we testing web content loaded in a separate process?
 var gBrowserIsRemote;           // bool
-var gB2GisMulet;                // bool
 // Are we using <iframe mozbrowser>?
 var gBrowserIsIframe;           // bool
 var gBrowserMessageManager;
 var gCanvas1, gCanvas2;
 // gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
 // RecordResult.
 var gCurrentCanvas = null;
 var gURLs;
@@ -278,22 +277,16 @@ this.OnRefTestLoad = function OnRefTestL
                 getService(Components.interfaces.nsIPrefBranch);
     try {
         gBrowserIsRemote = prefs.getBoolPref("browser.tabs.remote.autostart");
     } catch (e) {
         gBrowserIsRemote = false;
     }
 
     try {
-        gB2GisMulet = prefs.getBoolPref("b2g.is_mulet");
-    } catch (e) {
-        gB2GisMulet = false;
-    }
-
-    try {
       gBrowserIsIframe = prefs.getBoolPref("reftest.browser.iframe.enabled");
     } catch (e) {
       gBrowserIsIframe = false;
     }
 
     try {
       gLogLevel = prefs.getCharPref("reftest.logLevel");
     } catch (e) {
@@ -318,22 +311,17 @@ this.OnRefTestLoad = function OnRefTestL
     gBrowser.setAttribute("type", "content");
     gBrowser.setAttribute("primary", "true");
     gBrowser.setAttribute("remote", gBrowserIsRemote ? "true" : "false");
     // Make sure the browser element is exactly 800x1000, no matter
     // what size our window is
     gBrowser.setAttribute("style", "padding: 0px; margin: 0px; border:none; min-width: 800px; min-height: 1000px; max-width: 800px; max-height: 1000px");
 
     if (Services.appinfo.OS == "Android") {
-      let doc;
-      if (Services.appinfo.widgetToolkit == "gonk") {
-        doc = gContainingWindow.document.getElementsByTagName("html")[0];
-      } else {
-        doc = gContainingWindow.document.getElementById('main-window');
-      }
+      let doc = gContainingWindow.document.getElementById('main-window');
       while (doc.hasChildNodes()) {
         doc.removeChild(doc.firstChild);
       }
       doc.appendChild(gBrowser);
     } else {
       document.getElementById("reftest-window").appendChild(gBrowser);
     }
 
@@ -686,18 +674,17 @@ function BuildConditionSandbox(aURL) {
     sandbox.d3d9 =
       gWindowUtils.layerManagerType == "Direct3D 9";
     sandbox.layersOpenGL =
       gWindowUtils.layerManagerType == "OpenGL";
     sandbox.layersOMTC =
       gWindowUtils.layerManagerRemote == true;
 
     // Shortcuts for widget toolkits.
-    sandbox.B2G = xr.widgetToolkit == "gonk";
-    sandbox.Android = xr.OS == "Android" && !sandbox.B2G;
+    sandbox.Android = xr.OS == "Android";
     sandbox.cocoaWidget = xr.widgetToolkit == "cocoa";
     sandbox.gtkWidget = xr.widgetToolkit == "gtk2"
                         || xr.widgetToolkit == "gtk3";
     sandbox.qtWidget = xr.widgetToolkit == "qt";
     sandbox.winWidget = xr.widgetToolkit == "windows";
 
     // Scrollbars that are semi-transparent. See bug 1169666.
     sandbox.transparentScrollbars = xr.widgetToolkit == "gtk3";
@@ -763,17 +750,16 @@ function BuildConditionSandbox(aURL) {
     sandbox.prefs = CU.cloneInto({
         getBoolPref: function(p) { return prefs.getBoolPref(p); },
         getIntPref:  function(p) { return prefs.getIntPref(p); }
     }, sandbox, { cloneFunctions: true });
 
     // Tests shouldn't care about this except for when they need to
     // crash the content process
     sandbox.browserIsRemote = gBrowserIsRemote;
-    sandbox.Mulet = gB2GisMulet;
 
     try {
         sandbox.asyncPan = gContainingWindow.document.docShell.asyncPanZoomEnabled;
     } catch (e) {
         sandbox.asyncPan = false;
     }
 
     if (!gDumpedConditionSandbox) {
--- a/layout/tools/reftest/reftestcommandline.py
+++ b/layout/tools/reftest/reftestcommandline.py
@@ -355,213 +355,16 @@ class DesktopArgumentsParser(ReftestArgu
                 options.app = bin_dir
 
         if options.symbolsPath and len(urlparse(options.symbolsPath).scheme) < 2:
             options.symbolsPath = reftest.getFullPath(options.symbolsPath)
 
         options.utilityPath = reftest.getFullPath(options.utilityPath)
 
 
-class B2GArgumentParser(ReftestArgumentsParser):
-    def __init__(self, **kwargs):
-        super(B2GArgumentParser, self).__init__(**kwargs)
-
-        self.add_argument("--browser-arg",
-                          action="store",
-                          type=str,
-                          dest="browser_arg",
-                          help="Optional command-line arg to pass to the browser")
-
-        self.add_argument("--b2gpath",
-                          action="store",
-                          type=str,
-                          dest="b2gPath",
-                          help="path to B2G repo or qemu dir")
-
-        self.add_argument("--emulator",
-                          action="store",
-                          type=str,
-                          dest="emulator",
-                          help="Architecture of emulator to use: x86 or arm")
-
-        self.add_argument("--emulator-res",
-                          action="store",
-                          type=str,
-                          dest="emulator_res",
-                          help="Emulator resolution of the format '<width>x<height>'")
-
-        self.add_argument("--no-window",
-                          action="store_true",
-                          dest="noWindow",
-                          default=False,
-                          help="Pass --no-window to the emulator")
-
-        self.add_argument("--adbpath",
-                          action="store",
-                          type=str,
-                          dest="adb_path",
-                          default="adb",
-                          help="path to adb")
-
-        self.add_argument("--deviceIP",
-                          action="store",
-                          type=str,
-                          dest="deviceIP",
-                          help="ip address of remote device to test")
-
-        self.add_argument("--devicePort",
-                          action="store",
-                          type=str,
-                          dest="devicePort",
-                          default="20701",
-                          help="port of remote device to test")
-
-        self.add_argument("--remote-logfile",
-                          action="store",
-                          type=str,
-                          dest="remoteLogFile",
-                          help="Name of log file on the device relative to the device root.  PLEASE ONLY USE A FILENAME.")
-
-        self.add_argument("--remote-webserver",
-                          action="store",
-                          type=str,
-                          dest="remoteWebServer",
-                          help="ip address where the remote web server is hosted at")
-
-        self.add_argument("--http-port",
-                          action="store",
-                          type=str,
-                          dest="httpPort",
-                          help="ip address where the remote web server is hosted at")
-
-        self.add_argument("--ssl-port",
-                          action="store",
-                          type=str,
-                          dest="sslPort",
-                          help="ip address where the remote web server is hosted at")
-
-        self.add_argument("--pidfile",
-                          action="store",
-                          type=str,
-                          dest="pidFile",
-                          default="",
-                          help="name of the pidfile to generate")
-
-        self.add_argument("--gecko-path",
-                          action="store",
-                          type=str,
-                          dest="geckoPath",
-                          help="the path to a gecko distribution that should "
-                          "be installed on the emulator prior to test")
-
-        self.add_argument("--logdir",
-                          action="store",
-                          type=str,
-                          dest="logdir",
-                          help="directory to store log files")
-
-        self.add_argument('--busybox',
-                          action='store',
-                          type=str,
-                          dest='busybox',
-                          help="Path to busybox binary to install on device")
-
-        self.add_argument("--httpd-path",
-                          action="store",
-                          type=str,
-                          dest="httpdPath",
-                          help="path to the httpd.js file")
-
-        self.add_argument("--profile",
-                          action="store",
-                          type=str,
-                          dest="profile",
-                          help="for mulet testing, the path to the "
-                          "gaia profile to use")
-
-        self.add_argument("--mulet",
-                          action="store_true",
-                          dest="mulet",
-                          default=False,
-                          help="Run the tests on a B2G desktop build")
-
-        self.set_defaults(remoteTestRoot=None,
-                          logFile="reftest.log",
-                          autorun=True,
-                          closeWhenDone=True,
-                          testPath="")
-
-    def validate_remote(self, options, automation):
-        if not options.app:
-            options.app = automation.DEFAULT_APP
-
-        if not options.remoteTestRoot:
-            options.remoteTestRoot = automation._devicemanager.deviceRoot + \
-                "/reftest"
-
-        options.remoteProfile = options.remoteTestRoot + "/profile"
-
-        productRoot = options.remoteTestRoot + "/" + automation._product
-        if options.utilityPath is None:
-            options.utilityPath = productRoot + "/bin"
-
-        if not options.httpPort:
-            options.httpPort = automation.DEFAULT_HTTP_PORT
-
-        if not options.sslPort:
-            options.sslPort = automation.DEFAULT_SSL_PORT
-
-        if options.remoteWebServer is None:
-            options.remoteWebServer = self.get_ip()
-
-        options.webServer = options.remoteWebServer
-
-        if options.geckoPath and not options.emulator:
-            self.error(
-                "You must specify --emulator if you specify --gecko-path")
-
-        if options.logdir and not options.emulator:
-            self.error("You must specify --emulator if you specify --logdir")
-
-        if options.remoteLogFile is None:
-            options.remoteLogFile = "reftest.log"
-
-        options.localLogName = options.remoteLogFile
-        options.remoteLogFile = options.remoteTestRoot + \
-            '/' + options.remoteLogFile
-
-        # Ensure that the options.logfile (which the base class uses) is set to
-        # the remote setting when running remote. Also, if the user set the
-        # log file name there, use that instead of reusing the remotelogfile as
-        # above.
-        if (options.logFile):
-            # If the user specified a local logfile name use that
-            options.localLogName = options.logFile
-        options.logFile = options.remoteLogFile
-
-        # Only reset the xrePath if it wasn't provided
-        if options.xrePath is None:
-            options.xrePath = options.utilityPath
-        options.xrePath = os.path.abspath(options.xrePath)
-
-        if options.pidFile != "":
-            f = open(options.pidFile, 'w')
-            f.write("%s" % os.getpid())
-            f.close()
-
-        # httpd-path is specified by standard makefile targets and may be specified
-        # on the command line to select a particular version of httpd.js. If not
-        # specified, try to select the one from from the xre bundle, as
-        # required in bug 882932.
-        if not options.httpdPath:
-            options.httpdPath = os.path.join(options.xrePath, "components")
-
-        return options
-
-
 class RemoteArgumentsParser(ReftestArgumentsParser):
     def __init__(self, **kwargs):
         super(RemoteArgumentsParser, self).__init__()
 
         # app, xrePath and utilityPath variables are set in main function
         self.set_defaults(logFile="reftest.log",
                           app="",
                           xrePath="",
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -599,21 +599,18 @@ class RefTest(object):
         }
 
         if interactive:
             # If an interactive debugger is attached,
             # don't use timeouts, and don't capture ctrl-c.
             timeout = None
             signal.signal(signal.SIGINT, lambda sigid, frame: None)
 
-        if mozinfo.info.get('appname') == 'b2g' and mozinfo.info.get('toolkit') != 'gonk':
-            runner_cls = mozrunner.Runner
-        else:
-            runner_cls = mozrunner.runners.get(mozinfo.info.get('appname', 'firefox'),
-                                               mozrunner.Runner)
+        runner_cls = mozrunner.runners.get(mozinfo.info.get('appname', 'firefox'),
+                                           mozrunner.Runner)
         runner = runner_cls(profile=profile,
                             binary=binary,
                             process_class=mozprocess.ProcessHandlerMixin,
                             cmdargs=cmdargs,
                             env=env,
                             process_args=kp_kwargs)
         runner.start(debug_args=debug_args,
                      interactive=interactive,
deleted file mode 100644
--- a/layout/tools/reftest/runreftestb2g.py
+++ /dev/null
@@ -1,425 +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/.
-
-import ConfigParser
-import os
-import sys
-import tempfile
-import traceback
-
-# We need to know our current directory so that we can serve our test files from it.
-here = os.path.abspath(os.path.dirname(__file__))
-if here not in sys.path:
-    sys.path.insert(0, here)
-
-from automation import Automation
-from b2gautomation import B2GRemoteAutomation
-from runreftestmulet import run_test_harness as run_mulet_reftests
-from output import OutputHandler
-from remotereftest import RemoteReftestResolver, ReftestServer
-from runreftest import RefTest
-import reftestcommandline
-
-from marionette_harness import Marionette
-from mozdevice import DeviceManagerADB, DMError
-
-
-class ProfileConfigParser(ConfigParser.RawConfigParser):
-    """Subclass of RawConfigParser that outputs .ini files in the exact
-       format expected for profiles.ini, which is slightly different
-       than the default format.
-    """
-
-    def optionxform(self, optionstr):
-        return optionstr
-
-    def write(self, fp):
-        if self._defaults:
-            fp.write("[%s]\n" % ConfigParser.DEFAULTSECT)
-            for (key, value) in self._defaults.items():
-                fp.write("%s=%s\n" % (key, str(value).replace('\n', '\n\t')))
-            fp.write("\n")
-        for section in self._sections:
-            fp.write("[%s]\n" % section)
-            for (key, value) in self._sections[section].items():
-                if key == "__name__":
-                    continue
-                if (value is not None) or (self._optcre == self.OPTCRE):
-                    key = "=".join((key, str(value).replace('\n', '\n\t')))
-                fp.write("%s\n" % (key))
-            fp.write("\n")
-
-class B2GRemoteReftest(RefTest):
-
-    _devicemanager = None
-    use_marionette = False
-    localProfile = None
-    remoteApp = ''
-    profile = None
-    resolver_cls = RemoteReftestResolver
-
-    def __init__(self, automation, devicemanager, options, scriptDir):
-        RefTest.__init__(self)
-        self.automation = automation
-        self._devicemanager = devicemanager
-        self.runSSLTunnel = False
-        self.remoteTestRoot = options.remoteTestRoot
-        self.remoteProfile = options.remoteProfile
-        self.automation.setRemoteProfile(self.remoteProfile)
-        self.localLogName = options.localLogName
-        self.remoteLogFile = options.remoteLogFile
-        self.bundlesDir = '/system/b2g/distribution/bundles'
-        self.remoteMozillaPath = '/data/b2g/mozilla'
-        self.remoteProfilesIniPath = os.path.join(self.remoteMozillaPath, 'profiles.ini')
-        self.originalProfilesIni = None
-        self.scriptDir = scriptDir
-        self.SERVER_STARTUP_TIMEOUT = 90
-        if self.automation.IS_DEBUG_BUILD:
-            self.SERVER_STARTUP_TIMEOUT = 180
-
-    def cleanup(self, profileDir):
-        # Pull results back from device
-        if (self.remoteLogFile):
-            try:
-                self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
-            except:
-                print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
-                sys.exit(5)
-
-        # Delete any bundled extensions
-        if profileDir:
-            extensionDir = os.path.join(profileDir, 'extensions', 'staged')
-            for filename in os.listdir(extensionDir):
-                try:
-                    self._devicemanager._checkCmd(['shell', 'rm', '-rf',
-                                                     os.path.join(self.bundlesDir, filename)])
-                except DMError:
-                    pass
-
-        # Restore the original profiles.ini.
-        if self.originalProfilesIni:
-            try:
-                if not self.automation._is_emulator:
-                    self.restoreProfilesIni()
-                os.remove(self.originalProfilesIni)
-            except:
-                pass
-
-        if not self.automation._is_emulator:
-            self._devicemanager.removeFile(self.remoteLogFile)
-            self._devicemanager.removeDir(self.remoteProfile)
-            self._devicemanager.removeDir(self.remoteTestRoot)
-
-            # We've restored the original profile, so reboot the device so that
-            # it gets picked up.
-            self.automation.rebootDevice()
-
-        RefTest.cleanup(self, profileDir)
-        if getattr(self, 'pidFile', '') != '':
-            try:
-                os.remove(self.pidFile)
-                os.remove(self.pidFile + ".xpcshell.pid")
-            except:
-                print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
-
-    def findPath(self, paths, filename = None):
-        for path in paths:
-            p = path
-            if filename:
-                p = os.path.join(p, filename)
-            if os.path.exists(self.getFullPath(p)):
-                return path
-        return None
-
-    def startWebServer(self, options):
-        """ Create the webserver on the host and start it up """
-        remoteXrePath = options.xrePath
-        remoteProfilePath = self.remoteProfile
-        remoteUtilityPath = options.utilityPath
-        localAutomation = Automation()
-        localAutomation.IS_WIN32 = False
-        localAutomation.IS_LINUX = False
-        localAutomation.IS_MAC = False
-        localAutomation.UNIXISH = False
-        hostos = sys.platform
-        if hostos in ['mac', 'darwin']:
-            localAutomation.IS_MAC = True
-        elif hostos in ['linux', 'linux2']:
-            localAutomation.IS_LINUX = True
-            localAutomation.UNIXISH = True
-        elif hostos in ['win32', 'win64']:
-            localAutomation.BIN_SUFFIX = ".exe"
-            localAutomation.IS_WIN32 = True
-
-        paths = [options.xrePath,
-                 localAutomation.DIST_BIN,
-                 self.automation._product,
-                 os.path.join('..', self.automation._product)]
-        options.xrePath = self.findPath(paths)
-        if options.xrePath == None:
-            print "ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name)
-            sys.exit(1)
-        paths.append("bin")
-        paths.append(os.path.join("..", "bin"))
-
-        xpcshell = "xpcshell"
-        if (os.name == "nt"):
-            xpcshell += ".exe"
-
-        options.utilityPath = self.findPath(paths, xpcshell)
-        if options.utilityPath == None:
-            print "ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name)
-            sys.exit(1)
-
-        xpcshell = os.path.join(options.utilityPath, xpcshell)
-        if self.automation.elf_arm(xpcshell):
-            raise Exception('xpcshell at %s is an ARM binary; please use '
-                            'the --utility-path argument to specify the path '
-                            'to a desktop version.' % xpcshell)
-
-        options.serverProfilePath = tempfile.mkdtemp()
-        self.server = ReftestServer(localAutomation, options, self.scriptDir)
-        retVal = self.server.start()
-        if retVal:
-            return retVal
-
-        if (options.pidFile != ""):
-            f = open(options.pidFile + ".xpcshell.pid", 'w')
-            f.write("%s" % self.server._process.pid)
-            f.close()
-
-        retVal = self.server.ensureReady(self.SERVER_STARTUP_TIMEOUT)
-        if retVal:
-            return retVal
-
-        options.xrePath = remoteXrePath
-        options.utilityPath = remoteUtilityPath
-        options.profilePath = remoteProfilePath
-        return 0
-
-    def stopWebServer(self, options):
-        if hasattr(self, 'server'):
-            self.server.stop()
-
-    def restoreProfilesIni(self):
-        # restore profiles.ini on the device to its previous state
-        if not self.originalProfilesIni or not os.access(self.originalProfilesIni, os.F_OK):
-            raise DMError('Unable to install original profiles.ini; file not found: %s',
-                          self.originalProfilesIni)
-
-        self._devicemanager.pushFile(self.originalProfilesIni, self.remoteProfilesIniPath)
-
-    def updateProfilesIni(self, profilePath):
-        # update profiles.ini on the device to point to the test profile
-        self.originalProfilesIni = tempfile.mktemp()
-        self._devicemanager.getFile(self.remoteProfilesIniPath, self.originalProfilesIni)
-
-        config = ProfileConfigParser()
-        config.read(self.originalProfilesIni)
-        for section in config.sections():
-            if 'Profile' in section:
-                config.set(section, 'IsRelative', 0)
-                config.set(section, 'Path', profilePath)
-
-        newProfilesIni = tempfile.mktemp()
-        with open(newProfilesIni, 'wb') as configfile:
-            config.write(configfile)
-
-        self._devicemanager.pushFile(newProfilesIni, self.remoteProfilesIniPath)
-        try:
-            os.remove(newProfilesIni)
-        except:
-            pass
-
-
-    def createReftestProfile(self, options, manifests):
-        profile = RefTest.createReftestProfile(self, options, manifests,
-                                               server=options.remoteWebServer)
-        profileDir = profile.profile
-
-        prefs = {}
-
-        # Turn off the locale picker screen
-        prefs["browser.firstrun.show.localepicker"] = False
-        prefs["b2g.system_startup_url"] = "app://test-container.gaiamobile.org/index.html"
-        prefs["b2g.system_manifest_url"] = "app://test-container.gaiamobile.org/manifest.webapp"
-        prefs["dom.ipc.tabs.disabled"] = False
-        prefs["dom.mozBrowserFramesEnabled"] = True
-        prefs["font.size.inflation.emPerLine"] = 0
-        prefs["font.size.inflation.minTwips"] = 0
-        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
-        prefs["reftest.browser.iframe.enabled"] = False
-        prefs["reftest.remote"] = True
-
-        # Make sure we disable system updates
-        prefs["app.update.enabled"] = False
-        prefs["app.update.url"] = ""
-        # Disable webapp updates
-        prefs["webapps.update.enabled"] = False
-        # Disable tiles also
-        prefs["browser.newtabpage.directory.source"] = ""
-        prefs["browser.newtabpage.directory.ping"] = ""
-
-        # Set the extra prefs.
-        profile.set_preferences(prefs)
-
-        # Copy the profile to the device.
-        self._devicemanager.removeDir(self.remoteProfile)
-        try:
-            self._devicemanager.pushDir(profileDir, self.remoteProfile)
-        except DMError:
-            print "Automation Error: Unable to copy profile to device."
-            raise
-
-        # Copy the extensions to the B2G bundles dir.
-        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
-        # need to write to read-only dir
-        self._devicemanager._checkCmd(['remount'])
-        for filename in os.listdir(extensionDir):
-            self._devicemanager._checkCmd(['shell', 'rm', '-rf',
-                                             os.path.join(self.bundlesDir, filename)])
-        try:
-            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
-        except DMError:
-            print "Automation Error: Unable to copy extensions to device."
-            raise
-
-        self.updateProfilesIni(self.remoteProfile)
-
-        options.profilePath = self.remoteProfile
-        return profile
-
-    def copyExtraFilesToProfile(self, options, profile):
-        profileDir = profile.profile
-        RefTest.copyExtraFilesToProfile(self, options, profile)
-        try:
-            self._devicemanager.pushDir(profileDir, options.remoteProfile)
-        except DMError:
-            print "Automation Error: Failed to copy extra files to device"
-            raise
-
-    def environment(self, **kwargs):
-     return self.automation.environment(**kwargs)
-
-    def runApp(self, profile, binary, cmdargs, env,
-               timeout=None, debuggerInfo=None,
-               symbolsPath=None, options=None,
-               valgrindPath=None, valgrindArgs=None, valgrindSuppFiles=None):
-
-        outputHandler = OutputHandler(self.log, options.utilityPath, options.symbolsPath)
-        status = self.automation.runApp(None, env,
-                                        binary,
-                                        profile.profile,
-                                        cmdargs,
-                                        utilityPath=options.utilityPath,
-                                        xrePath=options.xrePath,
-                                        debuggerInfo=debuggerInfo,
-                                        symbolsPath=symbolsPath,
-                                        timeout=timeout,
-                                        outputHandler=outputHandler)
-        return status
-
-
-def run_test_harness(parser, options):
-    if options.mulet:
-        return run_mulet_reftests(parser, options)
-
-    auto = B2GRemoteAutomation(None, "fennec")
-
-    # create our Marionette instance
-    kwargs = {}
-    if options.emulator:
-        kwargs['emulator'] = options.emulator
-        auto.setEmulator(True)
-        if options.noWindow:
-            kwargs['noWindow'] = True
-        if options.geckoPath:
-            kwargs['gecko_path'] = options.geckoPath
-        if options.logdir:
-            kwargs['logdir'] = options.logdir
-        if options.busybox:
-            kwargs['busybox'] = options.busybox
-        if options.symbolsPath:
-            kwargs['symbols_path'] = options.symbolsPath
-    if options.emulator_res:
-        kwargs['emulator_res'] = options.emulator_res
-    if options.b2gPath:
-        kwargs['homedir'] = options.b2gPath
-    if options.marionette:
-        host,port = options.marionette.split(':')
-        kwargs['host'] = host
-        kwargs['port'] = int(port)
-    if options.adb_path:
-        kwargs['adb_path'] = options.adb_path
-    marionette = Marionette(**kwargs)
-    auto.marionette = marionette
-
-    if options.emulator:
-        dm = marionette.emulator.dm
-    else:
-        # create the DeviceManager
-        kwargs = {'adbPath': options.adb_path,
-                  'deviceRoot': options.remoteTestRoot}
-        if options.deviceIP:
-            kwargs.update({'host': options.deviceIP,
-                           'port': options.devicePort})
-        dm = DeviceManagerADB(**kwargs)
-    auto.setDeviceManager(dm)
-
-    parser.validate_remote(options, auto)
-
-    # TODO fix exception
-    if not options.ignoreWindowSize:
-        parts = dm.getInfo('screen')['screen'][0].split()
-        width = int(parts[0].split(':')[1])
-        height = int(parts[1].split(':')[1])
-        if (width < 1366 or height < 1050):
-            print "ERROR: Invalid screen resolution %sx%s, please adjust to 1366x1050 or higher" % (width, height)
-            return 1
-
-    auto.setProduct("b2g")
-    auto.test_script = os.path.join(here, 'b2g_start_script.js')
-    auto.test_script_args = [options.remoteWebServer, options.httpPort]
-
-    reftest = B2GRemoteReftest(auto, dm, options, here)
-    parser.validate(options, reftest)
-
-    logParent = os.path.dirname(options.remoteLogFile)
-    dm.mkDir(logParent);
-    auto.setRemoteLog(options.remoteLogFile)
-    auto.setServerInfo(options.webServer, options.httpPort, options.sslPort)
-
-    # Hack in a symbolic link for jsreftest
-    os.system("ln -s %s %s" % (os.path.join('..', 'jsreftest'), os.path.join(here, 'jsreftest')))
-
-
-    # Start the webserver
-    retVal = 1
-    try:
-        retVal = reftest.startWebServer(options)
-        if retVal:
-            return retVal
-        procName = options.app.split('/')[-1]
-        if (dm.processExist(procName)):
-            dm.killProcess(procName)
-
-        retVal = reftest.runTests(options.tests, options)
-    except:
-        print "Automation Error: Exception caught while running tests"
-        traceback.print_exc()
-        reftest.stopWebServer(options)
-        try:
-            reftest.cleanup(None)
-        except:
-            pass
-        return 1
-
-    reftest.stopWebServer(options)
-    return retVal
-
-
-if __name__ == "__main__":
-    parser = reftestcommandline.B2GArgumentParser()
-    options = parser.parse_args()
-    sys.exit(run_test_harness(parser, options))
deleted file mode 100644
--- a/layout/tools/reftest/runreftestmulet.py
+++ /dev/null
@@ -1,203 +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 __future__ import print_function, unicode_literals
-
-import os
-import signal
-import sys
-
-here = os.path.abspath(os.path.dirname(__file__))
-
-from marionette_driver import expected
-from marionette_driver.by import By
-from marionette_driver.marionette import Marionette
-from marionette_driver.wait import Wait
-
-from mozprocess import ProcessHandler
-from mozrunner import FirefoxRunner
-import mozinfo
-import mozlog
-
-from runreftest import RefTest
-from output import OutputHandler
-import reftestcommandline
-
-
-class MuletReftest(RefTest):
-    build_type = "mulet"
-    marionette = None
-
-    def __init__(self, marionette_args):
-        RefTest.__init__(self)
-        self.last_test = os.path.basename(__file__)
-        self.marionette_args = marionette_args
-        self.profile = None
-        self.runner = None
-        self.test_script = os.path.join(here, 'b2g_start_script.js')
-        self.timeout = None
-
-    def run_marionette_script(self):
-        self.marionette = Marionette(**self.marionette_args)
-        assert(self.marionette.wait_for_port())
-        self.marionette.start_session()
-        if self.build_type == "mulet":
-            self._wait_for_homescreen(timeout=300)
-            self._unlockScreen()
-        self.marionette.set_context(self.marionette.CONTEXT_CHROME)
-
-        if os.path.isfile(self.test_script):
-            f = open(self.test_script, 'r')
-            self.test_script = f.read()
-            f.close()
-        self.marionette.execute_script(self.test_script)
-
-    def run_tests(self, tests, options):
-        manifests = self.resolver.resolveManifests(options, tests)
-
-        self.profile = self.create_profile(options, manifests,
-                                           profile_to_clone=options.profile)
-        env = self.buildBrowserEnv(options, self.profile.profile)
-
-        self._populate_logger(options)
-        outputHandler = OutputHandler(self.log, options.utilityPath, symbolsPath=options.symbolsPath)
-
-        kp_kwargs = { 'processOutputLine': [outputHandler],
-                      'onTimeout': [self._on_timeout],
-                      'kill_on_timeout': False }
-
-        if not options.debugger:
-            if not options.timeout:
-                if mozinfo.info['debug']:
-                    options.timeout = 420
-                else:
-                    options.timeout = 300
-            self.timeout = options.timeout + 30.0
-
-        self.log.info("%s | Running tests: start." % os.path.basename(__file__))
-        cmd, args = self.build_command_line(options.app,
-                            ignore_window_size=options.ignoreWindowSize,
-                            browser_arg=options.browser_arg)
-        self.runner = FirefoxRunner(profile=self.profile,
-                                    binary=cmd,
-                                    cmdargs=args,
-                                    env=env,
-                                    process_class=ProcessHandler,
-                                    process_args=kp_kwargs,
-                                    symbols_path=options.symbolsPath)
-
-        status = 0
-        try:
-            self.runner.start(outputTimeout=self.timeout)
-            self.log.info("%s | Application pid: %d" % (
-                     os.path.basename(__file__),
-                     self.runner.process_handler.pid))
-
-            # kick starts the reftest harness
-            self.run_marionette_script()
-            status = self.runner.wait()
-        finally:
-            self.runner.check_for_crashes(test_name=self.last_test)
-            self.runner.cleanup()
-
-        if status > 0:
-            self.log.testFail("%s | application terminated with exit code %s" % (
-                         self.last_test, status))
-        elif status < 0:
-            self.log.info("%s | application killed with signal %s" % (
-                         self.last_test, -status))
-
-        self.log.info("%s | Running tests: end." % os.path.basename(__file__))
-        return status
-
-    def create_profile(self, options, manifests, profile_to_clone=None):
-        profile = RefTest.createReftestProfile(self, options, manifests,
-                                               profile_to_clone=profile_to_clone)
-
-        prefs = {}
-        # Turn off the locale picker screen
-        prefs["browser.firstrun.show.localepicker"] = False
-        if not self.build_type == "mulet":
-            # FIXME: With Mulet we can't set this values since Gaia won't launch
-            prefs["b2g.system_startup_url"] = \
-                    "app://test-container.gaiamobile.org/index.html"
-            prefs["b2g.system_manifest_url"] = \
-                    "app://test-container.gaiamobile.org/manifest.webapp"
-        # Make sure we disable system updates
-        prefs["app.update.enabled"] = False
-        prefs["app.update.url"] = ""
-        # Disable webapp updates
-        prefs["webapps.update.enabled"] = False
-        # Disable tiles also
-        prefs["browser.newtabpage.directory.source"] = ""
-        prefs["browser.newtabpage.directory.ping"] = ""
-        prefs["dom.ipc.tabs.disabled"] = False
-        prefs["dom.mozBrowserFramesEnabled"] = True
-        prefs["font.size.inflation.emPerLine"] = 0
-        prefs["font.size.inflation.minTwips"] = 0
-        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
-        prefs["reftest.browser.iframe.enabled"] = False
-        prefs["reftest.remote"] = False
-
-        # Set the extra prefs.
-        profile.set_preferences(prefs)
-        return profile
-
-    def build_command_line(self, app, ignore_window_size=False,
-                           browser_arg=None):
-        cmd = os.path.abspath(app)
-        args = ['-marionette']
-
-        if browser_arg:
-            args += [browser_arg]
-
-        if not ignore_window_size:
-            args.extend(['--screen', '800x1000'])
-
-        if self.build_type == "mulet":
-            args += ['-chrome', 'chrome://b2g/content/shell.html']
-        return cmd, args
-
-    def _on_timeout(self):
-        msg = "%s | application timed out after %s seconds with no output"
-        self.log.testFail(msg % (self.last_test, self.timeout))
-        self.log.error("Force-terminating active process(es).");
-
-        # kill process to get a stack
-        self.runner.stop(sig=signal.SIGABRT)
-
-    def _unlockScreen(self):
-        self.marionette.set_context(self.marionette.CONTEXT_CONTENT)
-        self.marionette.import_script(os.path.abspath(
-            os.path.join(__file__, os.path.pardir, "gaia_lock_screen.js")))
-        self.marionette.switch_to_frame()
-        self.marionette.execute_async_script('GaiaLockScreen.unlock()')
-
-    def _wait_for_homescreen(self, timeout):
-        self.log.info("Waiting for home screen to load")
-        Wait(self.marionette, timeout).until(expected.element_present(
-            By.CSS_SELECTOR, '#homescreen[loading-state=false]'))
-
-
-def run_test_harness(parser, options):
-    marionette_args = {}
-    if options.marionette:
-        host, port = options.marionette.split(':')
-        marionette_args['host'] = host
-        marionette_args['port'] = int(port)
-
-    reftest = MuletReftest(marionette_args)
-    parser.validate(options, reftest)
-
-    # add a -bin suffix if b2g-bin exists, but just b2g was specified
-    if options.app[-4:] != '-bin':
-        if os.path.isfile("%s-bin" % options.app):
-            options.app = "%s-bin" % options.app
-
-    if options.xrePath is None:
-        options.xrePath = os.path.dirname(options.app)
-
-    if options.mulet and not options.profile:
-        raise Exception("must specify --profile when specifying --mulet")
-
-    return reftest.run_tests(options.tests, options)
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -13,20 +13,16 @@ TEST_PACKAGE_NAME := $(ANDROID_PACKAGE_N
 endif
 
 # Linking xul-gtest.dll takes too long, so we disable GTest on
 # Windows PGO builds (bug 1028035).
 ifneq (1_WINNT,$(MOZ_PGO)_$(OS_ARCH))
 BUILD_GTEST=1
 endif
 
-ifdef MOZ_B2G
-BUILD_GTEST=
-endif
-
 ifneq (browser,$(MOZ_BUILD_APP))
 BUILD_GTEST=
 endif
 
 ifndef COMPILE_ENVIRONMENT
 BUILD_GTEST=
 endif
 
@@ -51,22 +47,16 @@ RUN_REFTEST = rm -f ./$@.log && $(PYTHON
 
 REMOTE_REFTEST = rm -f ./$@.log && $(PYTHON) _tests/reftest/remotereftest.py \
   --dm_trans=$(DM_TRANS) --ignore-window-size \
   --app=$(TEST_PACKAGE_NAME) --deviceIP=${TEST_DEVICE} --xre-path=${MOZ_HOST_BIN} \
   --httpd-path=_tests/modules --suite reftest \
   --extra-profile-file=$(topsrcdir)/mobile/android/fonts \
   $(SYMBOLS_PATH) $(EXTRA_TEST_ARGS) $(1) | tee ./$@.log
 
-RUN_REFTEST_B2G = rm -f ./$@.log && $(PYTHON) _tests/reftest/runreftestb2g.py \
-  --remote-webserver=10.0.2.2 --b2gpath=${B2G_PATH} --adbpath=${ADB_PATH} \
-  --xre-path=${MOZ_HOST_BIN} $(SYMBOLS_PATH) --ignore-window-size \
-  --httpd-path=_tests/modules \
-  $(EXTRA_TEST_ARGS) '$(1)' | tee ./$@.log
-
 ifeq ($(OS_ARCH),WINNT) #{
 # GPU-rendered shadow layers are unsupported here
 OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true --setpref=layers.acceleration.disabled=true
 GPU_RENDERING =
 else
 OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true
 GPU_RENDERING = --setpref=layers.acceleration.force-enabled=true
 endif #}
@@ -88,36 +78,16 @@ reftest-remote:
     elif [ '${TEST_DEVICE}' = '' -a '$(DM_TRANS)' != 'adb' ]; then \
         echo 'please prepare your host with the environment variable TEST_DEVICE'; \
     else \
         ln -s $(abspath $(topsrcdir)) _tests/reftest/tests; \
         $(call REMOTE_REFTEST,'tests/$(TEST_PATH)'); \
         $(CHECK_TEST_ERROR); \
     fi
 
-reftest-b2g: TEST_PATH?=layout/reftests/reftest.list
-reftest-b2g:
-	@if [ '${MOZ_HOST_BIN}' = '' ]; then \
-		echo 'environment variable MOZ_HOST_BIN must be set to a directory containing host xpcshell'; \
-	elif [ ! -d ${MOZ_HOST_BIN} ]; then \
-		echo 'MOZ_HOST_BIN does not specify a directory'; \
-	elif [ ! -f ${MOZ_HOST_BIN}/xpcshell ]; then \
-		echo 'xpcshell not found in MOZ_HOST_BIN'; \
-	elif [ '${B2G_PATH}' = '' -o '${ADB_PATH}' = '' ]; then \
-		echo 'please set the B2G_PATH and ADB_PATH environment variables'; \
-	else \
-        ln -s $(abspath $(topsrcdir)) _tests/reftest/tests; \
-		if [ '${REFTEST_PATH}' != '' ]; then \
-			$(call RUN_REFTEST_B2G,tests/${REFTEST_PATH}); \
-		else \
-			$(call RUN_REFTEST_B2G,tests/$(TEST_PATH)); \
-		fi; \
-        $(CHECK_TEST_ERROR); \
-	fi
-
 crashtest: TEST_PATH?=testing/crashtest/crashtests.list
 crashtest:
 	$(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)')
 	$(CHECK_TEST_ERROR)
 
 jstestbrowser: TESTS_PATH?=test-stage/jsreftest/tests/
 jstestbrowser:
 	$(MAKE) -C $(DEPTH)/config
@@ -212,36 +182,29 @@ endef
 
 $(foreach name,$(TEST_PKGS),$(eval $(call package_archive,$(name))))
 
 ifeq ($(MOZ_BUILD_APP),mobile/android)
 stage-all: stage-android
 stage-all: stage-instrumentation-tests
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gonk)
-stage-all: stage-b2g
-endif
-
 # Prepare _tests before any of the other staging/packaging steps.
 # make-stage-dir is a prerequisite to all the stage-* targets in testsuite-targets.mk.
 make-stage-dir: install-test-files
 	rm -rf $(PKG_STAGE)
 	$(NSINSTALL) -D $(PKG_STAGE)
 	$(NSINSTALL) -D $(PKG_STAGE)/bin
 	$(NSINSTALL) -D $(PKG_STAGE)/bin/components
 	$(NSINSTALL) -D $(PKG_STAGE)/certs
 	$(NSINSTALL) -D $(PKG_STAGE)/config
 	$(NSINSTALL) -D $(PKG_STAGE)/jetpack
 	$(NSINSTALL) -D $(PKG_STAGE)/modules
 	$(NSINSTALL) -D $(PKG_STAGE)/tools/mach
 
-stage-b2g: make-stage-dir
-	$(NSINSTALL) $(topsrcdir)/b2g/test/b2g-unittest-requirements.txt $(PKG_STAGE)/b2g
-
 stage-config: make-stage-dir
 	$(NSINSTALL) -D $(PKG_STAGE)/config
 	@(cd $(topsrcdir)/testing/config && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/config && tar -xf -)
 
 stage-mach: make-stage-dir
 	@(cd $(topsrcdir)/python/mach && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/tools/mach && tar -xf -)
 	cp $(topsrcdir)/testing/tools/mach_test_package_bootstrap.py $(PKG_STAGE)/tools/mach_bootstrap.py
 	cp $(topsrcdir)/mach $(PKG_STAGE)
@@ -324,17 +287,16 @@ check::
   crashtest \
   xpcshell-tests \
   jstestbrowser \
   package-tests \
   package-tests-prepare-dest \
   package-tests-common \
   make-stage-dir \
   stage-all \
-  stage-b2g \
   stage-config \
   stage-mochitest \
   stage-jstests \
   stage-android \
   stage-jetpack \
   stage-steeplechase \
   stage-instrumentation-tests \
   test-packages-manifest \