blob: 282734589c8d62feaee1e1dbf661584399cfcdc4 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>reserve succeeds from a Service Worker</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../serviceworker/resources/test-helpers.js"></script>
<script src="../notifications/resources/test-helpers.js"></script>
</head>
<body>
<script>
promise_test(async function(test) {
const script = 'resources/instrumentation-service-worker.js';
const scope = 'resources/scope/' + location.pathname;
let workerInfo =
await getActiveServiceWorkerWithMessagePort(test, script, scope);
let port = workerInfo.port;
let data = await sendCommand(port, {
command: 'mockSetReserveSuccess',
success: true
});
assert_equals(data.command, 'mockSetReserveSuccess');
assert_true(data.success);
data = await sendCommand(port, { command: 'reserve' });
assert_equals(data.command, 'reserve');
assert_true(data.success,
'reserve should succeed. Error message: ' + data.errorMessage);
}, 'reserve should succeed from Service Worker');
</script>
</body>
</html>