2015-01-13 01:53:14 -08:00
|
|
|
<!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() {
|
|
|
|
if (SpecialPowers.isMainProcess()) {
|
|
|
|
SpecialPowers.Cu.import("resource://gre/modules/RequestSyncService.jsm");
|
|
|
|
}
|
|
|
|
runTests();
|
|
|
|
},
|
|
|
|
|
|
|
|
test_managerRegistrationsEmpty,
|
|
|
|
test_registrationsEmpty,
|
|
|
|
|
|
|
|
test_registerFailure,
|
|
|
|
test_register,
|
|
|
|
// overwrite the same registration.
|
|
|
|
test_register,
|
|
|
|
|
2015-01-13 01:53:24 -08:00
|
|
|
function() { test_managerRegistrations('wifiOnly', 0); },
|
2015-01-13 01:53:14 -08:00
|
|
|
test_registrations,
|
|
|
|
|
|
|
|
test_registrationEmpty,
|
|
|
|
test_registration,
|
|
|
|
|
2015-01-13 01:53:24 -08:00
|
|
|
function() { test_managerSetPolicy('disabled', 123); },
|
|
|
|
function() { test_managerRegistrations('disabled', 123); },
|
|
|
|
|
|
|
|
function() { test_managerSetPolicy('enabled', 42); },
|
|
|
|
function() { test_managerRegistrations('enabled', 42); },
|
|
|
|
|
2015-01-13 01:53:14 -08:00
|
|
|
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>
|