Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / serviceworker / access-container-on-local-file.html
blob4d2896356b994b3c50d53dc4e59ff18338da5eeb
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
6 async_test(function(t) {
7 var script = 'no-such-worker';
8 navigator.serviceWorker.register(script, { scope: script })
9 .then(function() {
10 assert_unreached('register() should fail');
11 }, function(e) {
12 assert_throws(
13 'SecurityError', function() { throw e; },
14 'register() on local file should fail');
15 assert_equals(
16 e.message,
17 'Failed to register a ServiceWorker: The URL protocol of the ' +
18 'current origin (\'file://\') is not supported.',
19 'register() should fail due to unsupported URL protocol');
20 t.done();
22 .catch(t.step_func(function(e) {
23 assert_unreached(e);
24 t.done();
25 }));
26 }, 'Calling register() on local file');
28 async_test(function(t) {
29 navigator.serviceWorker.getRegistration()
30 .then(function() {
31 assert_unreached('getRegistration() should fail')
32 }, function(e) {
33 assert_throws(
34 'SecurityError', function() { throw e; },
35 'getRegistration() on local file should fail');
36 assert_equals(
37 e.message,
38 'Failed to get a ServiceWorkerRegistration: The URL protocol of ' +
39 'the current origin (\'file://\') is not supported.',
40 'getRegistration() should fail due to unsupported URL protocol');
41 t.done();
43 .catch(t.step_func(function(e) {
44 assert_unreached(e);
45 t.done();
46 }));
47 }, 'Calling getRegistration() on local file');
49 </script>