OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Registration</title> | 2 <title>Service Worker: Registration</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="resources/test-helpers.js"></script> | 5 <script src="resources/test-helpers.js"></script> |
6 <script> | 6 <script> |
7 (function() { | 7 (function() { |
8 var t = async_test('Registering normal pattern'); | 8 var t = async_test('Registering normal pattern'); |
9 t.step(function() { | 9 t.step(function() { |
10 var scope = '/registration/*'; | 10 var scope = '/registration/*'; |
(...skipping 26 matching lines...) Expand all Loading... | |
37 t.step_func(function(reason) { | 37 t.step_func(function(reason) { |
38 assert_equals(reason.name, 'SecurityError', | 38 assert_equals(reason.name, 'SecurityError', |
39 'Registration scope outside domain should fail wit h SecurityError.'); | 39 'Registration scope outside domain should fail wit h SecurityError.'); |
40 t.done(); | 40 t.done(); |
41 }) | 41 }) |
42 ); | 42 ); |
43 }); | 43 }); |
44 }()); | 44 }()); |
45 | 45 |
46 (function() { | 46 (function() { |
47 var t = async_test('Registering default scope'); | |
jsbell
2014/06/18 17:57:03
There's a test for the default scope in servicewor
xiang
2014/06/19 04:57:45
The default scope tests in serviceworkerglobalscop
| |
48 t.step(function() { | |
49 navigator.serviceWorker.register('resources/registration-worker.js' | |
50 ).then( | |
51 t.step_func(function(worker) { | |
52 var default_scope = '/*'; | |
53 assert_equals(worker.scope, location.origin + default_scope, | |
54 'Registration scope should default to "/*".'); | |
55 service_worker_unregister_and_done(t, default_scope); | |
56 }), | |
57 t.step_func(function(reason) { | |
58 assert_unreached('Registration should succeed, but failed: ' + r eason.name); | |
59 }) | |
60 ); | |
61 }); | |
62 }()); | |
63 | |
64 (function() { | |
47 var t = async_test('Registering script outside domain'); | 65 var t = async_test('Registering script outside domain'); |
48 t.step(function() { | 66 t.step(function() { |
49 navigator.serviceWorker.register( | 67 navigator.serviceWorker.register( |
50 'http://example.com/worker.js' | 68 'http://example.com/worker.js' |
51 ).then( | 69 ).then( |
52 t.step_func(function(worker) { | 70 t.step_func(function(worker) { |
53 assert_unreached('Registration script outside domain should fail .'); | 71 assert_unreached('Registration script outside domain should fail .'); |
54 }), | 72 }), |
55 t.step_func(function(reason) { | 73 t.step_func(function(reason) { |
56 assert_equals(reason.name, 'SecurityError', | 74 assert_equals(reason.name, 'SecurityError', |
(...skipping 16 matching lines...) Expand all Loading... | |
73 t.step_func(function(reason) { | 91 t.step_func(function(reason) { |
74 assert_equals(reason.name, 'AbortError', | 92 assert_equals(reason.name, 'AbortError', |
75 'Registration of non-existent script should fail.') ; | 93 'Registration of non-existent script should fail.') ; |
76 t.done(); | 94 t.done(); |
77 }) | 95 }) |
78 ); | 96 ); |
79 }); | 97 }); |
80 }()); | 98 }()); |
81 | 99 |
82 </script> | 100 </script> |
OLD | NEW |