зеркало из https://github.com/mozilla/gecko-dev.git
78 строки
1.9 KiB
HTML
78 строки
1.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for RequestSync basic use</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="common_basic.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<script type="application/javascript;version=1.7">
|
|
|
|
|
|
var tests = [
|
|
function() {
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.requestSync.enabled", true],
|
|
["dom.requestSync.minInterval", 1],
|
|
["dom.ignore_webidl_scope_checks", true]]}, runTests);
|
|
},
|
|
|
|
function() {
|
|
SpecialPowers.pushPermissions(
|
|
[{ "type": "requestsync-manager", "allow": 1, "context": document } ], runTests);
|
|
},
|
|
|
|
function() {
|
|
SpecialPowers.importInMainProcess("resource://gre/modules/RequestSyncService.jsm");
|
|
runTests();
|
|
},
|
|
|
|
test_managerRegistrationsEmpty,
|
|
test_registrationsEmpty,
|
|
|
|
test_registerFailure,
|
|
test_register,
|
|
// overwrite the same registration.
|
|
test_register,
|
|
|
|
function() { test_managerRegistrations('wifiOnly', 0); },
|
|
test_registrations,
|
|
|
|
test_registrationEmpty,
|
|
test_registration,
|
|
|
|
function() { test_managerSetPolicy('disabled', 123); },
|
|
function() { test_managerRegistrations('disabled', 123); },
|
|
|
|
function() { test_managerSetPolicy('enabled', 42); },
|
|
function() { test_managerRegistrations('enabled', 42); },
|
|
|
|
test_unregister,
|
|
test_unregisterDuplicate,
|
|
|
|
test_managerRegistrationsEmpty,
|
|
test_registrationsEmpty,
|
|
];
|
|
|
|
function runTests() {
|
|
if (!tests.length) {
|
|
finish();
|
|
return;
|
|
}
|
|
|
|
var test = tests.shift();
|
|
test();
|
|
}
|
|
|
|
function finish() {
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
runTests();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|