Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / oninstall-script-error.html
blobfb63bc32e24598a9152a310e6bfc759807f89a37
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharness-helpers.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7 function wait_for_install_event(worker) {
8 return new Promise(function(resolve) {
9 worker.addEventListener('statechange', function(event) {
10 if (worker.state == 'installed')
11 resolve(true);
12 else if (worker.state == 'redundant')
13 resolve(false);
14 });
15 });
18 function make_test(name, script, expect_install) {
19 promise_test(function(t) {
20 var scope = script;
21 return service_worker_unregister_and_register(t, script, scope)
22 .then(function(registration) {
23 return wait_for_install_event(registration.installing);
25 .then(function(did_install) {
26 assert_equals(did_install, expect_install,
27 'The worker was installed');
29 }, name);
34 name: 'install handler throws an error',
35 script: 'resources/oninstall-throw-error-worker.js',
36 expect_install: false
39 name: 'install handler throws an error, error handler does not cancel',
40 script: 'resources/oninstall-throw-error-with-empty-onerror-worker.js',
41 expect_install: false
44 name: 'install handler dispatches an event that throws an error',
45 script: 'resources/oninstall-throw-error-from-nested-event-worker.js',
46 expect_install: true
49 name: 'install handler throws an error that is cancelled',
50 script: 'resources/oninstall-throw-error-then-cancel-worker.js',
51 expect_install: true
54 name: 'install handler throws an error and prevents default',
55 script: 'resources/oninstall-throw-error-then-prevent-default-worker.js',
56 expect_install: true
58 ].forEach(function(test_case) {
59 make_test(test_case.name, test_case.script, test_case.expect_install);
60 });
61 </script>