Bug 1374204 - verify webrtc peerconnection tests with android hardware encoder and legacy encoder. r?jib draft
authorMunro Mengjue Chiang <mchiang@mozilla.com>
Mon, 19 Jun 2017 18:22:15 +0800
changeset 597895 67b6dd1995408a263071fdc20aaafc14c2c03b2e
parent 597894 692457b55f335d4f69740bb53aebd532251e4fcb
child 634358 002d978002e685187e61d38bfe4bb5a565d9a4e3
push id65077
push userbmo:mchiang@mozilla.com
push dateWed, 21 Jun 2017 05:44:30 +0000
reviewersjib
bugs1374204
milestone56.0a1
Bug 1374204 - verify webrtc peerconnection tests with android hardware encoder and legacy encoder. r?jib MozReview-Commit-ID: 8M86Qqx7GZa
dom/media/tests/mochitest/pc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -2026,18 +2026,38 @@ var setupIceServerConfig = useIceServer 
   }
 
   return enableHttpProxy(false)
     .then(spawnIceServer)
     .then(iceServersStr => { iceServersArray = JSON.parse(iceServersStr); })
     .then(addTurnsSelfsignedCerts);
 };
 
-function runNetworkTest(testFunction, fixtureOptions) {
-  fixtureOptions = fixtureOptions || {}
-  return scriptsReady.then(() =>
-    runTestWhenReady(options =>
-      startNetworkAndTest()
-        .then(() => setupIceServerConfig(fixtureOptions.useIceServer))
-        .then(() => testFunction(options))
-    )
+async function runNetworkTest(testFunction, fixtureOptions = {}) {
+
+  let version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].
+    getService(SpecialPowers.Ci.nsIXULAppInfo).version;
+  let isNightly = version.endsWith("a1");
+  let isAndroid = !!navigator.userAgent.includes("Android");
+
+  await scriptsReady;
+  await runTestWhenReady(async options =>
+    {
+      await startNetworkAndTest();
+      await setupIceServerConfig(fixtureOptions.useIceServer);
+
+      // currently we set android hardware encoder default enabled in nightly.
+      // But before QA approves the quality, we want to ensure the legacy
+      // encoder is working fine.
+      if (isNightly && isAndroid) {
+        let value = Math.random() >= 0.5;
+        await SpecialPowers.pushPrefEnv(
+        {
+          set: [
+            ['media.navigator.hardware.vp8_encode.acceleration_enabled', value],
+            ['media.navigator.hardware.vp8_encode.acceleration_remote_enabled', value]
+          ]
+        });
+      }
+      await testFunction(options);
+    }
   );
 }