Bug 1465477 Part 3 - Add --save-recordings option to the mochitest harness, r=jmaher.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 23 Jul 2018 21:53:00 +0000
changeset 822122 9af637ffd0471c1a3c7b56d6efdf5863efd80cd4
parent 822121 6479d0bf85bc163082859c3d70f6b8c5e1d199f6
child 822123 cbee873889b50a9643b8c8a751f07e53205aef9c
push id117296
push userbmo:gl@mozilla.com
push dateTue, 24 Jul 2018 20:28:07 +0000
reviewersjmaher
bugs1465477
milestone63.0a1
Bug 1465477 Part 3 - Add --save-recordings option to the mochitest harness, r=jmaher.
testing/mochitest/mochitest_options.py
testing/mochitest/runtests.py
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -507,16 +507,21 @@ class MochitestArguments(ArgumentContain
          {"default": None,
           "help": "Debugger binary to run tests in. Program name or path.",
           }],
         [["--debugger-args"],
          {"dest": "debuggerArgs",
           "default": None,
           "help": "Arguments to pass to the debugger.",
           }],
+        [["--save-recordings"],
+         {"dest": "recordingPath",
+          "default": None,
+          "help": "Directory to save Web Replay recordings in.",
+          }],
         [["--valgrind"],
          {"default": None,
           "help": "Valgrind binary to run tests with. Program name or path.",
           }],
         [["--valgrind-args"],
          {"dest": "valgrindArgs",
           "default": None,
           "help": "Comma-separated list of extra arguments to pass to Valgrind.",
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1926,16 +1926,20 @@ toolbar#nav-bar {
         if getattr(self, 'testRootAbs', None):
             prefs['mochitest.testRoot'] = self.testRootAbs
 
         # See if we should use fake media devices.
         if options.useTestMediaDevices:
             prefs['media.audio_loopback_dev'] = self.mediaDevices['audio']
             prefs['media.video_loopback_dev'] = self.mediaDevices['video']
 
+        # Disable web replay rewinding by default if recordings are being saved.
+        if options.recordingPath:
+            prefs["devtools.recordreplay.enableRewinding"] = False
+
         self.profile.set_preferences(prefs)
 
         # Extra prefs from --setpref
         self.profile.set_preferences(self.extraPrefs(options.extraPrefs))
         return manifest
 
     def getGMPPluginPath(self, options):
         if options.gmp_path:
@@ -2723,16 +2727,19 @@ toolbar#nav-bar {
 
             if options.immersiveMode:
                 options.browserArgs.extend(('-firefoxpath', options.app))
                 options.app = self.immersiveHelperPath
 
             if options.jsdebugger:
                 options.browserArgs.extend(['-jsdebugger', '-wait-for-jsdebugger'])
 
+            if options.recordingPath:
+                options.browserArgs.extend(['--save-recordings', options.recordingPath])
+
             # Remove the leak detection file so it can't "leak" to the tests run.
             # The file is not there if leak logging was not enabled in the
             # application build.
             if os.path.exists(self.leak_report_file):
                 os.remove(self.leak_report_file)
 
             # then again to actually run mochitest
             if options.timeout: