Bug 906837 - Add mach command for running webapprt chrome tests. r=adw, r=gps
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Fri, 23 Aug 2013 10:06:16 -0400
changeset 143976 de82a0040f1ab9c5f514fae59f8c8d1f6eadcc12
parent 143975 073fbcfa3e1f0d7860780c35717b30041a7d29b3
child 143977 816c1730c8ece1fb15834370843bea2432d6de18
push id2327
push userryanvm@gmail.com
push dateFri, 23 Aug 2013 14:07:00 +0000
treeherderfx-team@816c1730c8ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, gps
bugs906837
milestone26.0a1
Bug 906837 - Add mach command for running webapprt chrome tests. r=adw, r=gps
testing/mochitest/mach_commands.py
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -106,29 +106,44 @@ class MochitestRunner(MozbuildObject):
         for handler in remove_handlers:
             logging.getLogger().removeHandler(handler)
 
         runner = mochitest.Mochitest(automation)
 
         opts = mochitest.MochitestOptions(automation)
         options, args = opts.parse_args([])
 
+        appname = ''
+        if sys.platform.startswith('darwin'):
+            appname = os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME'],
+            'Contents', 'MacOS', 'webapprt-stub' + automation.BIN_SUFFIX)
+        else:
+            appname = os.path.join(self.distdir, 'bin', 'webapprt-stub' +
+            automation.BIN_SUFFIX)
+
         # Need to set the suite options before verifyOptions below.
         if suite == 'plain':
             # Don't need additional options for plain.
             pass
         elif suite == 'chrome':
             options.chrome = True
         elif suite == 'browser':
             options.browserChrome = True
         elif suite == 'metro':
             options.immersiveMode = True
             options.browserChrome = True
         elif suite == 'a11y':
             options.a11y = True
+        elif suite == 'webapprt-content':
+            options.webapprtContent = True
+            options.app = appname
+        elif suite == 'webapprt-chrome':
+            options.webapprtChrome = True
+            options.app = appname
+            options.browserArgs.append("-test-mode")
         else:
             raise Exception('None or unrecognized mochitest suite type.')
 
         options.autorun = not no_autorun
         options.closeWhenDone = not keep_open
         options.shuffle = shuffle
         options.consoleLevel = 'INFO'
         options.repeat = repeat
@@ -222,17 +237,17 @@ def MochitestCommand(func):
         help='Shuffle execution order.')
     func = shuffle(func)
 
     keep_open = CommandArgument('--keep-open', action='store_true',
         help='Keep the browser open after tests complete.')
     func = keep_open(func)
 
     rerun = CommandArgument('--rerun-failures', action='store_true',
-        help='Run only the tests that filed during the last test run.')
+        help='Run only the tests that failed during the last test run.')
     func = rerun(func)
 
     autorun = CommandArgument('--no-autorun', action='store_true',
         help='Do not starting running tests automatically.')
     func = autorun(func)
 
     repeat = CommandArgument('--repeat', type=int, default=0,
         help='Repeat the test the given number of times.')
@@ -285,14 +300,26 @@ class MachCommands(MachCommandBase):
         return self.run_mochitest(test_file, 'metro', **kwargs)
 
     @Command('mochitest-a11y', category='testing',
         description='Run an a11y mochitest.')
     @MochitestCommand
     def run_mochitest_a11y(self, test_file, **kwargs):
         return self.run_mochitest(test_file, 'a11y', **kwargs)
 
+    @Command('webapprt-test-chrome', category='testing',
+        description='Run a webapprt chrome mochitest.')
+    @MochitestCommand
+    def run_mochitest_webapprt_chrome(self, test_file, **kwargs):
+        return self.run_mochitest(test_file, 'webapprt-chrome', **kwargs)
+
+    @Command('webapprt-test-content', category='testing',
+        description='Run a webapprt content mochitest.')
+    @MochitestCommand
+    def run_mochitest_webapprt_content(self, test_file, **kwargs):
+        return self.run_mochitest(test_file, 'webapprt-content', **kwargs)
+
     def run_mochitest(self, test_file, flavor, **kwargs):
         self._ensure_state_subdir_exists('.')
 
         mochitest = self._spawn(MochitestRunner)
         return mochitest.run_mochitest_test(test_file=test_file, suite=flavor,
             **kwargs)