Bug 1058158 - Run marionette unit tests in test-container, remove oop option; r=jgriffin a=test-only
authorMalini Das <mdas@mozilla.com>
Fri, 19 Sep 2014 10:35:31 -0700
changeset 224956 2c38a719e7a7e9089c4fbc1b956435b469763adb
parent 224955 b51bf05a133f931b42cea229fa8d9376545f42aa
child 224957 0d23cb46b0f326189d8d33cb9282753594e65820
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin, test-only
bugs1058158
milestone34.0a2
Bug 1058158 - Run marionette unit tests in test-container, remove oop option; r=jgriffin a=test-only
testing/marionette/client/marionette/marionette_test.py
testing/marionette/client/marionette/runner/base.py
testing/marionette/client/marionette/tests/unit-tests.ini
testing/marionette/client/marionette/tests/unit/oop/manifest-oop-both.ini
testing/marionette/client/marionette/tests/unit/oop/manifest-oop-false.ini
testing/marionette/client/marionette/tests/unit/oop/manifest-oop-true.ini
testing/marionette/client/marionette/tests/unit/oop/manifest-oop-unspecified.ini
testing/marionette/client/marionette/tests/unit/oop/manifest.ini
testing/marionette/client/marionette/tests/unit/oop/test_success_both.js
testing/marionette/client/marionette/tests/unit/oop/test_success_both2.js
testing/marionette/client/marionette/tests/unit/oop/test_success_in_non_oop.js
testing/marionette/client/marionette/tests/unit/oop/test_success_in_non_oop2.js
testing/marionette/client/marionette/tests/unit/oop/test_success_in_oop.js
testing/marionette/client/marionette/tests/unit/oop/test_success_in_oop2.js
testing/marionette/client/marionette/tests/unit/test_navigation.py
testing/marionette/client/marionette/tests/unit/test_specialpowers.py
testing/marionette/client/marionette/tests/unit/unit-tests.ini
--- a/testing/marionette/client/marionette/marionette_test.py
+++ b/testing/marionette/client/marionette/marionette_test.py
@@ -19,16 +19,19 @@ from errors import (
         JavascriptException, NoSuchElementException, XPathLookupException, NoSuchWindowException,
         StaleElementException, ScriptTimeoutException, ElementNotVisibleException,
         NoSuchFrameException, InvalidElementStateException, NoAlertPresentException,
         InvalidCookieDomainException, UnableToSetCookieException, InvalidSelectorException,
         MoveTargetOutOfBoundsException, FrameSendNotInitializedError, FrameSendFailureError
         )
 from marionette import Marionette
 from mozlog.structured.structuredlog import get_default_logger
+from wait import Wait
+from expected import element_present, element_not_present
+
 
 class SkipTest(Exception):
     """
     Raise this exception in a test to skip it.
 
     Usually you can use TestResult.skip() or one of the skipping decorators
     instead of raising this directly.
     """
@@ -74,20 +77,20 @@ def expectedFailure(func):
             func(*args, **kwargs)
         except Exception:
             raise _ExpectedFailure(sys.exc_info())
         raise _UnexpectedSuccess
     return wrapper
 
 def skip_if_b2g(target):
     def wrapper(self, *args, **kwargs):
-        if not hasattr(self.marionette, 'b2g') or not self.marionette.b2g:
+        if not self.marionette.session_capabilities['device'] == 'qemu':
             return target(self, *args, **kwargs)
         else:
-            sys.stderr.write('skipping ... ')
+            raise SkipTest('skipping due to b2g')
     return wrapper
 
 class CommonTestCase(unittest.TestCase):
 
     match_re = None
     failureException = AssertionError
 
     def __init__(self, methodName, **kwargs):
@@ -281,16 +284,22 @@ permissions.forEach(function (perm) {
         if self.marionette.session is None:
             self.marionette.start_session()
         if self.marionette.timeout is not None:
             self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, self.marionette.timeout)
             self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT, self.marionette.timeout)
             self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, self.marionette.timeout)
         else:
             self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, 30000)
+        if hasattr(self, 'test_container') and self.test_container:
+            self.switch_into_test_container()
+        else:
+            if self.marionette.session_capabilities.has_key('b2g') \
+            and self.marionette.session_capabilities['b2g'] == True:
+                self.close_test_container()
 
     def tearDown(self):
         pass
 
     def cleanTest(self):
         self._deleteSession()
 
     def _deleteSession(self):
@@ -308,28 +317,119 @@ permissions.forEach(function (perm) {
                     # Gecko has crashed?
                     self.marionette.session = None
                     try:
                         self.marionette.client.close()
                     except socket.error:
                         pass
         self.marionette = None
 
+    def switch_into_test_container(self):
+        self.marionette.set_context("content")
+        frame = None
+        try:
+            frame = self.marionette.find_element(
+                'css selector',
+                'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
+            )
+        except NoSuchElementException:
+            result = self.marionette.execute_async_script("""
+if((navigator.mozSettings == undefined) || (navigator.mozSettings == null) || (navigator.mozApps == undefined) || (navigator.mozApps == null)) {
+    marionetteScriptFinished(false);
+    return;
+}
+let setReq = navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
+setReq.onsuccess = function() {
+    let appsReq = navigator.mozApps.mgmt.getAll();
+    appsReq.onsuccess = function() {
+        let apps = appsReq.result;
+        for (let i = 0; i < apps.length; i++) {
+            let app = apps[i];
+            if (app.manifest.name === 'Test Container') {
+                app.launch();
+                window.addEventListener('apploadtime', function apploadtime(){
+                    window.removeEventListener('apploadtime', apploadtime);
+                    marionetteScriptFinished(true);
+                });
+                return;
+            }
+        }
+        marionetteScriptFinished(false);
+    }
+    appsReq.onerror = function() {
+        marionetteScriptFinished(false);
+    }
+}
+setReq.onerror = function() {
+    marionetteScriptFinished(false);
+}""", script_timeout=60000)
+
+            self.assertTrue(result)
+            frame = Wait(self.marionette, timeout=10, interval=0.2).until(element_present(
+                'css selector',
+                'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
+            ))
+
+        self.marionette.switch_to_frame(frame)
+
+    def close_test_container(self):
+        self.marionette.set_context("content")
+        self.marionette.switch_to_frame()
+        result = self.marionette.execute_async_script("""
+if((navigator.mozSettings == undefined) || (navigator.mozSettings == null) || (navigator.mozApps == undefined) || (navigator.mozApps == null)) {
+    marionetteScriptFinished(false);
+    return;
+}
+let setReq = navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
+setReq.onsuccess = function() {
+    let appsReq = navigator.mozApps.mgmt.getAll();
+    appsReq.onsuccess = function() {
+        let apps = appsReq.result;
+        for (let i = 0; i < apps.length; i++) {
+            let app = apps[i];
+            if (app.manifest.name === 'Test Container') {
+                let manager = window.wrappedJSObject.AppWindowManager || window.wrappedJSObject.WindowManager;
+                if (!manager) {
+                    marionetteScriptFinished(false);
+                    return;
+                }
+                manager.kill(app.origin);
+                marionetteScriptFinished(true);
+                return;
+            }
+        }
+        marionetteScriptFinished(false);
+    }
+    appsReq.onerror = function() {
+        marionetteScriptFinished(false);
+    }
+}
+setReq.onerror = function() {
+    marionetteScriptFinished(false);
+}""", script_timeout=60000)
+
+        frame = Wait(self.marionette, timeout=10, interval=0.2).until(element_not_present(
+            'css selector',
+            'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
+        ))
+
+
 class MarionetteTestCase(CommonTestCase):
 
     match_re = re.compile(r"test_(.*)\.py$")
 
     def __init__(self, marionette_weakref, methodName='runTest',
                  filepath='', **kwargs):
         self._marionette_weakref = marionette_weakref
         self.marionette = None
         self.extra_emulator_index = -1
         self.methodName = methodName
         self.filepath = filepath
         self.testvars = kwargs.pop('testvars', None)
+        self.test_container = kwargs.pop('test_container', False)
         CommonTestCase.__init__(self, methodName, **kwargs)
 
     @classmethod
     def add_tests_to_suite(cls, mod_name, filepath, suite, testloader, marionette, testvars, **kwargs):
         test_mod = imp.load_source(mod_name, filepath)
 
         for name in dir(test_mod):
             obj = getattr(test_mod, name)
@@ -390,17 +490,17 @@ class MarionetteJSTestCase(CommonTestCas
     inactivity_timeout_re = re.compile(r"MARIONETTE_INACTIVITY_TIMEOUT(\s*)=(\s*)(\d+);")
     match_re = re.compile(r"test_(.*)\.js$")
 
     def __init__(self, marionette_weakref, methodName='runTest', jsFile=None, **kwargs):
         assert(jsFile)
         self.jsFile = jsFile
         self._marionette_weakref = marionette_weakref
         self.marionette = None
-        self.oop = kwargs.pop('oop')
+        self.test_container = kwargs.pop('test_container', False)
         CommonTestCase.__init__(self, methodName)
 
     @classmethod
     def add_tests_to_suite(cls, mod_name, filepath, suite, testloader, marionette, testvars, **kwargs):
         suite.addTest(cls(weakref.ref(marionette), jsFile=filepath, **kwargs))
 
     def runTest(self):
         if self.marionette.session is None:
@@ -414,64 +514,16 @@ class MarionetteJSTestCase(CommonTestCas
 
         if os.path.basename(self.jsFile).startswith('test_'):
             head_js = self.head_js_re.search(js);
             if head_js:
                 head_js = head_js.group(3)
                 head = open(os.path.join(os.path.dirname(self.jsFile), head_js), 'r')
                 js = head.read() + js;
 
-        if self.oop:
-            print 'running oop'
-            frame = None
-            try:
-                frame = self.marionette.find_element(
-                    'css selector',
-                    'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
-                )
-            except NoSuchElementException:
-                result = self.marionette.execute_async_script("""
-let setReq = navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
-setReq.onsuccess = function() {
-    let appsReq = navigator.mozApps.mgmt.getAll();
-    appsReq.onsuccess = function() {
-        let apps = appsReq.result;
-        for (let i = 0; i < apps.length; i++) {
-            let app = apps[i];
-            if (app.manifest.name === 'Test Container') {
-                app.launch();
-                window.addEventListener('apploadtime', function apploadtime(){
-                    window.removeEventListener('apploadtime', apploadtime);
-                    marionetteScriptFinished(true);
-                });
-                return;
-            }
-        }
-        marionetteScriptFinished(false);
-    }
-    appsReq.onerror = function() {
-        marionetteScriptFinished(false);
-    }
-}
-setReq.onerror = function() {
-    marionetteScriptFinished(false);
-}""", script_timeout=60000)
-                self.assertTrue(result)
-
-                frame = self.marionette.find_element(
-                    'css selector',
-                    'iframe[src*="app://test-container.gaiamobile.org/index.html"]'
-                )
-
-            self.marionette.switch_to_frame(frame)
-            main_process = self.marionette.execute_script("""
-                return SpecialPowers.isMainProcess();
-                """)
-            self.assertFalse(main_process)
-
         context = self.context_re.search(js)
         if context:
             context = context.group(3)
             self.marionette.set_context(context)
 
         if context != "chrome":
             self.marionette.navigate('data:text/html,<html>test page</html>')
 
@@ -530,13 +582,10 @@ setReq.onerror = function() {
         except ScriptTimeoutException:
             if 'timeout' in self.jsFile:
                 # expected exception
                 pass
             else:
                 self.loglines = self.marionette.get_logs()
                 raise
 
-        if self.oop:
-            self.marionette.switch_to_frame()
-
         self.marionette.execute_script("log('TEST-END: %s');" % self.jsFile.replace('\\', '\\\\'))
         self.marionette.test_name = None
--- a/testing/marionette/client/marionette/runner/base.py
+++ b/testing/marionette/client/marionette/runner/base.py
@@ -691,17 +691,17 @@ class BaseMarionetteTestRunner(object):
 
         for run_tests in self.mixin_run_tests:
             run_tests(tests)
         if self.shuffle:
             self.logger.info("Using seed where seed is:%d" % self.shuffle_seed)
 
         self.logger.suite_end()
 
-    def add_test(self, test, expected='pass', oop=None):
+    def add_test(self, test, expected='pass', test_container=False):
         filepath = os.path.abspath(test)
 
         if os.path.isdir(filepath):
             for root, dirs, files in os.walk(filepath):
                 for filename in files:
                     if (filename.startswith('test_') and
                         (filename.endswith('.py') or filename.endswith('.js'))):
                         filepath = os.path.join(root, filename)
@@ -714,18 +714,17 @@ class BaseMarionetteTestRunner(object):
             for atype in testtypes:
                 if atype.startswith('+'):
                     testargs.update({ atype[1:]: 'true' })
                 elif atype.startswith('-'):
                     testargs.update({ atype[1:]: 'false' })
                 else:
                     testargs.update({ atype: 'true' })
 
-        # testarg_oop = either None, 'true' or 'false'.
-        testarg_oop = testargs.get('oop')
+        testarg_b2g = bool(testargs.get('b2g'))
 
         file_ext = os.path.splitext(os.path.split(filepath)[-1])[1]
 
         if file_ext == '.ini':
             manifest = TestManifest()
             manifest.read(filepath)
 
             manifest_tests = manifest.active_tests(exists=False,
@@ -735,79 +734,41 @@ class BaseMarionetteTestRunner(object):
                                                    **mozinfo.info)
             unfiltered_tests = []
             for test in manifest_tests:
                 if test.get('disabled'):
                     self.manifest_skipped_tests.append(test)
                 else:
                     unfiltered_tests.append(test)
 
-            # Don't filter tests with "oop" flag because manifest parser can't
-            # handle it well.
-            if testarg_oop is not None:
-                del testargs['oop']
-
             target_tests = manifest.get(tests=unfiltered_tests, **testargs)
             for test in unfiltered_tests:
                 if test['path'] not in [x['path'] for x in target_tests]:
                     test.setdefault('disabled', 'filtered by type (%s)' % self.type)
                     self.manifest_skipped_tests.append(test)
 
             for i in target_tests:
                 if not os.path.exists(i["path"]):
                     raise IOError("test file: %s does not exist" % i["path"])
 
-                # manifest_oop is either 'false', 'true' or 'both'.  Anything
-                # else implies 'false'.
-                manifest_oop = i.get('oop', 'false')
-
-                # We only add an oop test when following conditions are met:
-                # 1) It's written by javascript because we have only
-                #    MarionetteJSTestCase that supports oop mode.
-                # 2) we're running with "--type=+oop" or no "--type=-oop", which
-                #    follows testarg_oop is either None or 'true' and must not
-                #    be 'false'.
-                # 3) When no "--type=[+-]oop" is applied, all active tests are
-                #    included in target_tests, so we must filter out those
-                #    really capable of running in oop mode. Besides, oop tests
-                #    must be explicitly specified for backward compatibility. So
-                #    test manifest_oop equals to either 'both' or 'true'.
                 file_ext = os.path.splitext(os.path.split(i['path'])[-1])[-1]
-                if (file_ext == '.js' and
-                    testarg_oop != 'false' and
-                    (manifest_oop == 'both' or manifest_oop == 'true')):
-                    self.add_test(i["path"], i["expected"], True)
-
-                # We only add an in-process test when following conditions are
-                # met:
-                # 1) we're running with "--type=-oop" or no "--type=+oop", which
-                #    follows testarg_oop is either None or 'false' and must not
-                #    be 'true'.
-                # 2) When no "--type=[+-]oop" is applied, all active tests are
-                #    included in target_tests, so we must filter out those
-                #    really capable of running in in-process mode.
-                if (testarg_oop != 'true' and
-                    (manifest_oop == 'both' or manifest_oop != 'true')):
-                    self.add_test(i["path"], i["expected"], False)
+                test_container = False
+                if i.get('test_container') and i.get('test_container') == 'true' and testarg_b2g:
+                    test_container = True
+                self.add_test(i["path"], i["expected"], test_container)
             return
 
-        if oop is None:
-            # This test is added by directory enumeration or directly specified
-            # in argument list.  We have no manifest information here so we just
-            # respect the "--type=[+-]oop" argument here.
-            oop = file_ext == '.js' and testarg_oop == 'true'
+        self.tests.append({'filepath': filepath, 'expected': expected, 'test_container': test_container})
 
-        self.tests.append({'filepath': filepath, 'expected': expected, 'oop': oop})
-
-    def run_test(self, filepath, expected, oop):
+    def run_test(self, filepath, expected, test_container):
 
         testloader = unittest.TestLoader()
         suite = unittest.TestSuite()
         self.test_kwargs['expected'] = expected
-        self.test_kwargs['oop'] = oop
+        self.test_kwargs['test_container'] = test_container
         mod_name = os.path.splitext(os.path.split(filepath)[-1])[0]
         for handler in self.test_handlers:
             if handler.match(os.path.basename(filepath)):
                 handler.add_tests_to_suite(mod_name,
                                            filepath,
                                            suite,
                                            testloader,
                                            self.marionette,
@@ -838,17 +799,17 @@ class BaseMarionetteTestRunner(object):
                 self.todo += len(results.expectedFailures)
 
     def run_test_set(self, tests):
         if self.shuffle:
             random.seed(self.shuffle_seed)
             random.shuffle(tests)
 
         for test in tests:
-            self.run_test(test['filepath'], test['expected'], test['oop'])
+            self.run_test(test['filepath'], test['expected'], test['test_container'])
             if self.marionette.check_for_crash():
                 break
 
     def run_test_sets(self):
         if self.total_chunks > len(self.tests):
             raise ValueError('Total number of chunks must be between 1 and %d.' % len(self.tests))
         if self.total_chunks > 1:
             chunks = [[] for i in range(self.total_chunks)]
@@ -857,21 +818,17 @@ class BaseMarionetteTestRunner(object):
                 chunks[target_chunk].append(test)
 
             self.logger.info('Running chunk %d of %d (%d tests selected from a '
                              'total of %d)' % (self.this_chunk, self.total_chunks,
                                                len(chunks[self.this_chunk - 1]),
                                                len(self.tests)))
             self.tests = chunks[self.this_chunk - 1]
 
-        oop_tests = [x for x in self.tests if x.get('oop')]
-        self.run_test_set(oop_tests)
-
-        in_process_tests = [x for x in self.tests if not x.get('oop')]
-        self.run_test_set(in_process_tests)
+        self.run_test_set(self.tests)
 
     def cleanup(self):
         if self.httpd:
             self.httpd.stop()
 
     __del__ = cleanup
 
     def generate_xml(self, results_list):
--- a/testing/marionette/client/marionette/tests/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit-tests.ini
@@ -8,16 +8,17 @@ browser = true
 ; true if the test is compatible with b2g, otherwise false
 b2g = true
 
 ; true if the test should be skipped
 skip = false
 
 ; marionette unit tests
 [include:unit/unit-tests.ini]
+test_container = true
 
 ; webapi tests
 [include:../../../../../dom/bluetooth/tests/marionette/manifest.ini]
 [include:../../../../../dom/telephony/test/marionette/manifest.ini]
 [include:../../../../../dom/voicemail/test/marionette/manifest.ini]
 [include:../../../../../dom/battery/test/marionette/manifest.ini]
 [include:../../../../../dom/mobilemessage/tests/marionette/manifest.ini]
 [include:../../../../../dom/mobileconnection/tests/marionette/manifest.ini]
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/manifest-oop-both.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[DEFAULT]
-qemu = false
-browser = false
-b2g = true
-skip = false
-
-oop = both
-
-[test_success_both2.js]
-; oop unspecified
-[test_success_in_non_oop.js]
-oop = false
-[test_success_in_oop.js]
-oop = true
-[test_success_both.js]
-oop = both
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/manifest-oop-false.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[DEFAULT]
-qemu = false
-browser = false
-b2g = true
-skip = false
-
-oop = false
-
-[test_success_in_non_oop2.js]
-; oop unspecified
-[test_success_in_non_oop.js]
-oop = false
-[test_success_in_oop.js]
-oop = true
-[test_success_both.js]
-oop = both
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/manifest-oop-true.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[DEFAULT]
-qemu = false
-browser = false
-b2g = true
-skip = false
-
-oop = true
-
-[test_success_in_oop2.js]
-; oop unspecified
-[test_success_in_non_oop.js]
-oop = false
-[test_success_in_oop.js]
-oop = true
-[test_success_both.js]
-oop = both
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/manifest-oop-unspecified.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[DEFAULT]
-qemu = false
-browser = false
-b2g = true
-skip = false
-
-[test_success_in_non_oop2.js]
-; oop unspecified
-[test_success_in_non_oop.js]
-oop = false
-[test_success_in_oop.js]
-oop = true
-[test_success_both.js]
-oop = both
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/manifest.ini
+++ /dev/null
@@ -1,10 +0,0 @@
-[DEFAULT]
-qemu = false
-browser = false
-b2g = true
-skip = false
-
-[include:manifest-oop-unspecified.ini]
-[include:manifest-oop-both.ini]
-[include:manifest-oop-true.ini]
-[include:manifest-oop-false.ini]
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/test_success_both.js
+++ /dev/null
@@ -1,3 +0,0 @@
-MARIONETTE_TIMEOUT = 60000;
-ok(true, "Always success");
-finish();
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/test_success_both2.js
+++ /dev/null
@@ -1,3 +0,0 @@
-MARIONETTE_TIMEOUT = 60000;
-ok(true, "Always success");
-finish();
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/test_success_in_non_oop.js
+++ /dev/null
@@ -1,3 +0,0 @@
-MARIONETTE_TIMEOUT = 60000;
-ok(SpecialPowers.isMainProcess(), "SpecialPowers.isMainProcess()");
-finish();
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/test_success_in_non_oop2.js
+++ /dev/null
@@ -1,3 +0,0 @@
-MARIONETTE_TIMEOUT = 60000;
-ok(SpecialPowers.isMainProcess(), "SpecialPowers.isMainProcess()");
-finish();
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/test_success_in_oop.js
+++ /dev/null
@@ -1,3 +0,0 @@
-MARIONETTE_TIMEOUT = 60000;
-ok(!SpecialPowers.isMainProcess(), "SpecialPowers.isMainProcess()");
-finish();
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/oop/test_success_in_oop2.js
+++ /dev/null
@@ -1,3 +0,0 @@
-MARIONETTE_TIMEOUT = 60000;
-ok(!SpecialPowers.isMainProcess(), "SpecialPowers.isMainProcess()");
-finish();
--- a/testing/marionette/client/marionette/tests/unit/test_navigation.py
+++ b/testing/marionette/client/marionette/tests/unit/test_navigation.py
@@ -1,16 +1,17 @@
 # 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_test import MarionetteTestCase
+from marionette_test import MarionetteTestCase, skip_if_b2g
 from errors import MarionetteException, TimeoutException
 
 class TestNavigate(MarionetteTestCase):
+
     def test_navigate(self):
         self.assertTrue(self.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
         self.assertEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         self.assertNotEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
         self.assertEqual("Marionette Test", self.marionette.title)
 
@@ -55,16 +56,17 @@ class TestNavigate(MarionetteTestCase):
         self.assertEqual("Marionette Test", self.marionette.title)
         self.assertTrue(self.marionette.execute_script("var elem = window.document.createElement('div'); elem.id = 'someDiv';" +
                                         "window.document.body.appendChild(elem); return true;"))
         self.assertFalse(self.marionette.execute_script("return window.document.getElementById('someDiv') == undefined;"))
         self.marionette.refresh()
         self.assertEqual("Marionette Test", self.marionette.title)
         self.assertTrue(self.marionette.execute_script("return window.document.getElementById('someDiv') == undefined;"))
 
+    @skip_if_b2g
     def test_navigate_frame(self):
         self.marionette.navigate(self.marionette.absolute_url("test_iframe.html"))
         self.marionette.switch_to_frame(0)
         self.marionette.navigate(self.marionette.absolute_url("empty.html"))
         self.assertTrue('empty.html' in self.marionette.get_url())
         self.marionette.switch_to_frame()
         self.assertTrue('test_iframe.html' in self.marionette.get_url())
 
--- a/testing/marionette/client/marionette/tests/unit/test_specialpowers.py
+++ b/testing/marionette/client/marionette/tests/unit/test_specialpowers.py
@@ -1,20 +1,22 @@
 # 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_test import MarionetteTestCase
+from marionette_test import MarionetteTestCase, skip_if_b2g
 from errors import JavascriptException, MarionetteException
 
 class TestSpecialPowersContent(MarionetteTestCase):
 
     testpref = "testing.marionette.contentcharpref"
     testvalue = "blabla"
 
+    # fails in b2g's test-container: "Error getting pref", Bug 1060061
+    @skip_if_b2g
     def test_prefs(self):
         result = self.marionette.execute_script("""
         SpecialPowers.setCharPref("%(pref)s", "%(value)s");
         return SpecialPowers.getCharPref("%(pref)s")
         """ % {'pref': self.testpref, 'value': self.testvalue}, special_powers=True);
         self.assertEqual(result, self.testvalue) 
 
     def test_prefs_after_navigate(self):
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini
@@ -12,16 +12,17 @@ b2g = true
 skip = false
 
 [test_session.py]
 [test_capabilities.py]
 
 [test_expectedfail.py]
 expected = fail
 [test_import_script.py]
+b2g = false
 [test_import_script_reuse_window.py]
 b2g = false
 [test_click.py]
 [test_click_chrome.py]
 b2g = false
 [test_selected.py]
 [test_selected_chrome.py]
 b2g = false
@@ -59,38 +60,44 @@ b2g = false
 
 [test_timeouts.py]
 
 [test_element_touch.py]
 b2g = true
 browser = false
 
 [test_gesture.py]
+disabled = "Bug 1060060"
 b2g = true
 browser = false
 
 [test_single_finger.py]
+disabled = "Bug 1060060"
 b2g = true
 browser = false
 [test_single_finger_desktop.py]
 b2g = false
 
 [test_multi_finger.py]
+disabled = "Bug 1060060"
 b2g = true
 browser = false
 
 [test_simpletest_pass.js]
 [test_simpletest_sanity.py]
 [test_simpletest_chrome.js]
 [test_simpletest_timeout.js]
 [test_specialpowers.py]
 [test_switch_anonymous_content.py]
 [test_switch_frame.py]
+b2g = false
 [test_switch_frame_chrome.py]
+b2g = false
 [test_switch_remote_frame.py]
+b2g = false
 
 [test_pagesource.py]
 b2g = false
 
 [test_visibility.py]
 [test_window_switching.py]
 b2g = false
 [test_window_management.py]
@@ -103,20 +110,19 @@ b2g = false
 [test_window_title.py]
 [test_window_type.py]
 [test_implicit_waits.py]
 [test_wait.py]
 [test_expected.py]
 [test_date_time_value.py]
 [test_getactiveframe_oop.py]
 disabled = "Bug 925688"
+b2g = false
 [test_submit.py]
 [test_chrome_async_finish.js]
 [test_screen_orientation.py]
 browser = false
 [test_errors.py]
 
 [test_execute_isolate.py]
 [test_click_scrolling.py]
 [test_profile_management.py]
 b2g = false
-
-[include:oop/manifest.ini]