OLD | NEW |
1 importScripts('interfaces.js'); | 1 importScripts('interfaces.js'); |
2 importScripts('worker-testharness.js'); | 2 importScripts('worker-testharness.js'); |
3 | 3 |
4 var EVENT_HANDLER = 'object'; | 4 var EVENT_HANDLER = 'object'; |
5 | 5 |
6 test(function() { | 6 test(function() { |
7 verify_interface('ServiceWorkerGlobalScope', | 7 verify_interface('ServiceWorkerGlobalScope', |
8 self, | 8 self, |
9 { | 9 { |
10 clients: 'object', | 10 clients: 'object', |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 delete: 'function', | 65 delete: 'function', |
66 keys: 'function' | 66 keys: 'function' |
67 }); | 67 }); |
68 }); | 68 }); |
69 }, 'Cache'); | 69 }, 'Cache'); |
70 | 70 |
71 test(function() { | 71 test(function() { |
72 assert_equals( | 72 assert_equals( |
73 new ExtendableEvent('ExtendableEvent').type, | 73 new ExtendableEvent('ExtendableEvent').type, |
74 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); | 74 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); |
| 75 assert_throws(new TypeError, function() { |
| 76 new FetchEvent('FetchEvent'); |
| 77 }, 'FetchEvent constructor with one argument throws'); |
| 78 assert_throws(new TypeError, function() { |
| 79 new FetchEvent('FetchEvent', {}); |
| 80 }, 'FetchEvent constructor with empty init dict throws'); |
| 81 assert_throws(new TypeError, function() { |
| 82 new FetchEvent('FetchEvent', {request: null}); |
| 83 }, 'FetchEvent constructor with null request member throws'); |
75 var req = new Request('https://www.example.com/', {method: 'POST'}); | 84 var req = new Request('https://www.example.com/', {method: 'POST'}); |
76 assert_equals( | 85 assert_equals( |
77 new FetchEvent('FetchEvent', {request: req}).type, | 86 new FetchEvent('FetchEvent', {request: req}).type, |
78 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); | 87 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); |
79 assert_equals( | 88 assert_equals( |
80 new FetchEvent('FetchEvent', {request: req}).cancelable, | 89 new FetchEvent('FetchEvent', {request: req}).cancelable, |
81 false, 'Default FetchEvent.cancelable should be false'); | 90 false, 'Default FetchEvent.cancelable should be false'); |
82 assert_equals( | 91 assert_equals( |
83 new FetchEvent('FetchEvent', {request: req}).bubbles, | 92 new FetchEvent('FetchEvent', {request: req}).bubbles, |
84 false, 'Default FetchEvent.bubbles should be false'); | 93 false, 'Default FetchEvent.bubbles should be false'); |
(...skipping 22 matching lines...) Expand all Loading... |
107 true, | 116 true, |
108 'FetchEvent.isReload with option {isReload: true} should be true'); | 117 'FetchEvent.isReload with option {isReload: true} should be true'); |
109 assert_equals( | 118 assert_equals( |
110 new FetchEvent( | 119 new FetchEvent( |
111 'FetchEvent', | 120 'FetchEvent', |
112 {request: req, isReload: true}).request.url, | 121 {request: req, isReload: true}).request.url, |
113 'https://www.example.com/', | 122 'https://www.example.com/', |
114 'FetchEvent.request.url should return the value it was ' + | 123 'FetchEvent.request.url should return the value it was ' + |
115 'initialized to'); | 124 'initialized to'); |
116 }, 'Event constructors'); | 125 }, 'Event constructors'); |
OLD | NEW |