michael@0: const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1; michael@0: const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1; michael@0: michael@0: // If we're running in a child window, shim things so it works the same michael@0: // as if we were running stand-alone. michael@0: if (window.opener) { michael@0: // Get test filename for page being run in popup so errors are more useful michael@0: var testName = location.pathname.split('/').pop(); michael@0: michael@0: // Wrap test functions and pass to parent window michael@0: window.ok = function(a, msg) { michael@0: opener.ok(a, testName + ": " + msg); michael@0: }; michael@0: michael@0: window.is = function(a, b, msg) { michael@0: opener.is(a, b, testName + ": " + msg); michael@0: }; michael@0: michael@0: window.isnot = function(a, b, msg) { michael@0: opener.isnot(a, b, testName + ": " + msg); michael@0: }; michael@0: michael@0: window.todo = function(a, msg) { michael@0: opener.todo(a, testName + ": " + msg); michael@0: }; michael@0: michael@0: window.todo_is = function(a, b, msg) { michael@0: opener.todo_is(a, b, testName + ": " + msg); michael@0: }; michael@0: michael@0: window.todo_isnot = function(a, b, msg) { michael@0: opener.todo_isnot(a, b, testName + ": " + msg); michael@0: }; michael@0: michael@0: // Override bits of SimpleTest so test files work stand-alone michael@0: var SimpleTest = SimpleTest || {}; michael@0: michael@0: SimpleTest.waitForExplicitFinish = function() { michael@0: dump("[POINTERLOCK] Starting " + testName+ "\n"); michael@0: }; michael@0: michael@0: SimpleTest.finish = function () { michael@0: dump("[POINTERLOCK] Finishing " + testName+ "\n"); michael@0: opener.nextTest(); michael@0: }; michael@0: } else { michael@0: // If we're not running in a child window, prefs need to get flipped here, michael@0: // otherwise it was already done in the test runner parent. michael@0: michael@0: // Ensure the full-screen api is enabled, and will be disabled on test exit. michael@0: SpecialPowers.setBoolPref("full-screen-api.enabled", true); michael@0: michael@0: // Disable the requirement for trusted contexts only, so the tests are easier to write. michael@0: SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false); michael@0: } michael@0: michael@0: addLoadEvent(function() { michael@0: if (typeof start !== 'undefined') { michael@0: SimpleTest.waitForFocus(start); michael@0: } michael@0: }); michael@0: