Bug 1540573 - p7. Modify CSP tests to use preload=2 on (emulated) cellular connections. r=jya
authorChris Pearce <cpearce@mozilla.com>
Fri, 03 May 2019 02:45:06 +0000
changeset 472437 dd882b8cd73efd56bc92aa1467139699e7e1db6d
parent 472436 b10d2cae45f2e0ea7809d60c54e80784ba871429
child 472438 04557fa70ce8a1dd168482b42b734647753c5b70
push id113012
push userdluca@mozilla.com
push dateFri, 03 May 2019 13:13:31 +0000
treeherdermozilla-inbound@d12dfc397c08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1540573
milestone68.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 1540573 - p7. Modify CSP tests to use preload=2 on (emulated) cellular connections. r=jya The Content Security Policy tests were handling the smaller android preload values that were #defined on Android by setting media.preload.default=2. Now that we're detecting whether we're on cellular or not, and the android emulators that our tests run on emulate a cellular connection, just setting media.preload.default is no longer enough. So set media.preload.default.cellular=2 in the CSP mochitests instead of media.preload.default, to make the CSP mochitests pass in the Android emulators. Differential Revision: https://phabricator.services.mozilla.com/D29617
dom/security/test/csp/test_CSP.html
dom/security/test/csp/test_redirects.html
testing/profiles/unittest-required/user.js
--- a/dom/security/test/csp/test_CSP.html
+++ b/dom/security/test/csp/test_CSP.html
@@ -101,22 +101,24 @@ window.testResult = function(testname, r
   // ... otherwise, finish
   window.examiner.remove();
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 SpecialPowers.pushPrefEnv(
-  {'set':[// This defaults to 0 ("preload none") on mobile (B2G/Android), which
-          // blocks loading the resource until the user interacts with a
-          // corresponding widget, which breaks the media_* tests. We set it
-          // back to the default used by desktop Firefox to get consistent
-          // behavior.
-          ["media.preload.default", 2]]},
+  {'set':[// On a cellular connection the default preload value is 0 ("preload
+          // none"). Our Android emulators emulate a cellular connection, and
+          // so by default preload no media data. This causes the media_* tests
+          // to timeout. We set the default used by cellular connections to the
+          // same as used by non-cellular connections in order to get
+          // consistent behavior across platforms/devices.
+          ["media.preload.default", 2],
+          ["media.preload.default.cellular", 2]]},
     function() {
       // save this for last so that our listeners are registered.
       // ... this loads the testbed of good and bad requests.
       document.getElementById('cspframe').src = 'file_main.html';
     });
 </script>
 </pre>
 </body>
--- a/dom/security/test/csp/test_redirects.html
+++ b/dom/security/test/csp/test_redirects.html
@@ -114,22 +114,24 @@ var testResult = function(testName, url,
 
   window.examiner.remove();
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 SpecialPowers.pushPrefEnv(
-  {'set':[// This defaults to 0 ("preload none") on mobile (B2G/Android), which
-          // blocks loading the resource until the user interacts with a
-          // corresponding widget, which breaks the media_* tests. We set it
-          // back to the default used by desktop Firefox to get consistent
-          // behavior.
-          ["media.preload.default", 2]]},
+  {'set':[// On a cellular connection the default preload value is 0 ("preload
+          // none"). Our Android emulators emulate a cellular connection, and
+          // so by default preload no media data. This causes the media_* tests
+          // to timeout. We set the default used by cellular connections to the
+          // same as used by non-cellular connections in order to get
+          // consistent behavior across platforms/devices.
+          ["media.preload.default", 2],
+          ["media.preload.default.cellular", 2]]},
   function() {
     // save this for last so that our listeners are registered.
     // ... this loads the testbed of good and bad requests.
     document.getElementById("harness").src = "file_redirects_main.html";
   });
 </script>
 </pre>
 
--- a/testing/profiles/unittest-required/user.js
+++ b/testing/profiles/unittest-required/user.js
@@ -172,16 +172,17 @@ user_pref("media.hls.server.url", "http:
 // Don't block old libavcodec libraries when testing, because our test systems
 // cannot easily be upgraded.
 user_pref("media.libavcodec.allow-obsolete", true);
 user_pref("media.memory_cache_max_size", 32);
 user_pref("media.memory_caches_combined_limit_kb", 256);
 user_pref("media.openUnsupportedTypeWithExternalApp", false);
 user_pref("media.preload.auto", 3); // auto = enough
 user_pref("media.preload.default", 2); // default = metadata
+user_pref("media.preload.default.cellular", 2); // default = metadata
 user_pref("media.suspend-bkgnd-video.enabled", false);
 user_pref("media.test.dumpDebugInfo", true);
 user_pref("media.volume_scale", "0.01");
 // Enable speech synth test service, and disable built in platform services.
 user_pref("media.webspeech.synth.test", true);
 user_pref("network.http.prompt-temp-redirect", false);
 // Disable speculative connections so they aren't reported as leaking when they're hanging around.
 user_pref("network.http.speculative-parallel-limit", 0);