diff --git a/content/media/test/Makefile.in b/content/media/test/Makefile.in index b636649089d9..49f580f66680 100644 --- a/content/media/test/Makefile.in +++ b/content/media/test/Makefile.in @@ -118,7 +118,6 @@ MOCHITEST_FILES = \ test_too_many_elements.html \ test_volume.html \ test_video_to_canvas.html \ - use_large_cache.js \ test_audiowrite.html \ test_mozHasAudio.html \ test_source_media.html \ diff --git a/content/media/test/manifest.js b/content/media/test/manifest.js index 4c017cab7440..6da639281812 100644 --- a/content/media/test/manifest.js +++ b/content/media/test/manifest.js @@ -558,7 +558,8 @@ function MediaTestManager() { this.numTestsRunning = 0; // Always wait for explicit finish. SimpleTest.waitForExplicitFinish(); - this.nextTest(); + + SpecialPowers.pushPrefEnv({"set": [["media.preload.default", 2], ["media.preload.auto", 3], ["media.opus.enabled", true]]}, function(aThis) {aThis.nextTest();}(this)); } // Registers that the test corresponding to 'token' has been started. @@ -646,31 +647,3 @@ function mediaTestCleanup() { } SpecialPowers.forceGC(); } - -(function() { - // Ensure that preload preferences are comsistent - var prefService = SpecialPowers.wrap(SpecialPowers.Components) - .classes["@mozilla.org/preferences-service;1"] - .getService(SpecialPowers.Ci.nsIPrefService); - var branch = prefService.getBranch("media."); - var oldDefault = 2; - var oldAuto = 3; - var oldOpus = undefined; - try { - oldDefault = branch.getIntPref("preload.default"); - oldAuto = branch.getIntPref("preload.auto"); - oldOpus = branch.getBoolPref("opus.enabled"); - } catch(ex) { } - branch.setIntPref("preload.default", 2); // preload_metadata - branch.setIntPref("preload.auto", 3); // preload_enough - // test opus playback iff the pref exists - if (oldOpus !== undefined) - branch.setBoolPref("opus.enabled", true); - - window.addEventListener("unload", function() { - branch.setIntPref("preload.default", oldDefault); - branch.setIntPref("preload.auto", oldAuto); - if (oldOpus !== undefined) - branch.setBoolPref("opus.enabled", oldOpus); - }, false); - })(); diff --git a/content/media/test/test_buffered.html b/content/media/test/test_buffered.html index 2c2ee0f1d5da..98ea36c9983f 100644 --- a/content/media/test/test_buffered.html +++ b/content/media/test/test_buffered.html @@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462957 -
Mozilla Bug 462957 @@ -85,8 +84,11 @@ function startTest(test, token) { document.body.appendChild(v); } -manager.runTests(gSeekTests, startTest); - +SimpleTest.waitForExplicitFinish(); +SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest); +function beginTest() { + manager.runTests(gSeekTests, startTest); +} diff --git a/content/media/test/test_bug493187.html b/content/media/test/test_bug493187.html index 25c27161f074..db9ce8ee8e80 100644 --- a/content/media/test/test_bug493187.html +++ b/content/media/test/test_bug493187.html @@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493187-diff --git a/content/media/test/test_video_to_canvas.html b/content/media/test/test_video_to_canvas.html index 4970aca66e24..b4a9f3752e98 100644 --- a/content/media/test/test_video_to_canvas.html +++ b/content/media/test/test_video_to_canvas.html @@ -9,7 +9,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=486646 - @@ -56,8 +55,11 @@ function startTest(test, token) { document.body.appendChild(v); } -manager.runTests(gSmallTests, startTest); - +SimpleTest.waitForExplicitFinish(); +SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest); +function beginTest() { + manager.runTests(gSmallTests, startTest); +} diff --git a/content/media/test/use_large_cache.js b/content/media/test/use_large_cache.js deleted file mode 100644 index 1b53240c114d..000000000000 --- a/content/media/test/use_large_cache.js +++ /dev/null @@ -1,14 +0,0 @@ -(function() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - // Set cache size to something large - var prefService = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefService); - var branch = prefService.getBranch("media."); - var oldSize = branch.getIntPref("cache_size"); - branch.setIntPref("cache_size", 40000); - - window.addEventListener("unload", function() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - branch.setIntPref("cache_size", oldSize); - }, false); - })(); diff --git a/layout/forms/test/test_bug411236.html b/layout/forms/test/test_bug411236.html index e545a3cadc5d..e5d0ebd60f28 100644 --- a/layout/forms/test/test_bug411236.html +++ b/layout/forms/test/test_bug411236.html @@ -24,20 +24,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=411236 window.oTarget = null; window.fileInputGotClick = false; -// accessibility.tabfocus must be set to value 7 before running test also -// on a mac. -function setOrRestoreTabFocus(newValue) { - const prefSvcContractID = "@mozilla.org/preferences-service;1"; - const prefSvcIID = SpecialPowers.Ci.nsIPrefService; - var prefs = SpecialPowers.Cc[prefSvcContractID].getService(prefSvcIID) - .getBranch("accessibility."); - if (!newValue) { - prefs.clearUserPref("tabfocus"); - } else { - prefs.setIntPref("tabfocus", newValue); - } -} - function tab() { var utils = SpecialPowers.DOMWindowUtils; // Send tab key events. @@ -57,7 +43,6 @@ function test() { if (i >= 100) { ok(false, "Couldn't find an input element!"); - setOrRestoreTabFocus(0); SimpleTest.finish(); return; } @@ -70,22 +55,25 @@ function test() { SpecialPowers.wrap(window.oTarget).dispatchEvent(e); ok(window.fileInputGotClick, "File input should have got a click event, but not open the file dialog."); - setOrRestoreTabFocus(0); SimpleTest.finish(); } +function beginTest() { + // accessibility.tabfocus must be set to value 7 before running test also + // on a mac. + SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}, do_test); +} + function do_test() { - setOrRestoreTabFocus(7); window.focus(); document.getElementById('fileinput').focus(); setTimeout(test, 100); } SimpleTest.waitForExplicitFinish(); -addLoadEvent(do_test); +addLoadEvent(beginTest);