OLD | NEW |
1 importScripts('interfaces.js'); | 1 importScripts('interfaces.js'); |
2 importScripts('worker-testharness.js'); | 2 importScripts('worker-testharness.js'); |
3 importScripts('../resources/testharness-helpers.js'); | 3 importScripts('../resources/testharness-helpers.js'); |
4 | 4 |
5 var EVENT_HANDLER = 'object'; | 5 var EVENT_HANDLER = 'object'; |
6 | 6 |
7 test(function() { | 7 test(function() { |
8 verify_interface('ServiceWorkerGlobalScope', | 8 verify_interface('ServiceWorkerGlobalScope', |
9 self, | 9 self, |
10 { | 10 { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 }); | 70 }); |
71 }, 'Cache'); | 71 }, 'Cache'); |
72 | 72 |
73 test(function() { | 73 test(function() { |
74 var req = new Request('http://{{host}}/', | 74 var req = new Request('http://{{host}}/', |
75 {method: 'POST', | 75 {method: 'POST', |
76 headers: [['Content-Type', 'Text/Html']]}); | 76 headers: [['Content-Type', 'Text/Html']]}); |
77 assert_equals( | 77 assert_equals( |
78 new ExtendableEvent('ExtendableEvent').type, | 78 new ExtendableEvent('ExtendableEvent').type, |
79 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); | 79 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); |
| 80 assert_throws(new TypeError, function() { |
| 81 new FetchEvent('FetchEvent'); |
| 82 }, 'FetchEvent constructor with one argument throws'); |
| 83 assert_throws(new TypeError, function() { |
| 84 new FetchEvent('FetchEvent', {}); |
| 85 }, 'FetchEvent constructor with empty init dict throws'); |
| 86 assert_throws(new TypeError, function() { |
| 87 new FetchEvent('FetchEvent', {request: null}); |
| 88 }, 'FetchEvent constructor with null request member throws'); |
80 assert_equals( | 89 assert_equals( |
81 new FetchEvent('FetchEvent', {request: req}).type, | 90 new FetchEvent('FetchEvent', {request: req}).type, |
82 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); | 91 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); |
83 assert_equals( | 92 assert_equals( |
84 new FetchEvent('FetchEvent', {request: req}).cancelable, | 93 new FetchEvent('FetchEvent', {request: req}).cancelable, |
85 false, 'Default FetchEvent.cancelable should be false'); | 94 false, 'Default FetchEvent.cancelable should be false'); |
86 assert_equals( | 95 assert_equals( |
87 new FetchEvent('FetchEvent', {request: req}).bubbles, | 96 new FetchEvent('FetchEvent', {request: req}).bubbles, |
88 false, 'Default FetchEvent.bubbles should be false'); | 97 false, 'Default FetchEvent.bubbles should be false'); |
89 assert_equals( | 98 assert_equals( |
90 new FetchEvent('FetchEvent', {request: req}).clientId, | 99 new FetchEvent('FetchEvent', {request: req}).clientId, |
91 null, 'Default FetchEvent.clientId should be null'); | 100 null, 'Default FetchEvent.clientId should be null'); |
92 assert_equals( | 101 assert_equals( |
93 new FetchEvent('FetchEvent', {request: req}).isReload, | 102 new FetchEvent('FetchEvent', {request: req}).isReload, |
94 false, 'Default FetchEvent.isReload should be false'); | 103 false, 'Default FetchEvent.isReload should be false'); |
95 assert_equals( | 104 assert_equals( |
96 new FetchEvent('FetchEvent', {request: req, cancelable: false}).cancelable
, | 105 new FetchEvent('FetchEvent', {request: req, cancelable: false}).cancelable
, |
97 false, 'FetchEvent.cancelable should be false'); | 106 false, 'FetchEvent.cancelable should be false'); |
98 assert_equals( | 107 assert_equals( |
99 new FetchEvent('FetchEvent', {request: req, clientId : 'test-client-id'}).
clientId, 'test-client-id', | 108 new FetchEvent('FetchEvent', {request: req, clientId : 'test-client-id'}).
clientId, 'test-client-id', |
100 'FetchEvent.clientId with option {clientId : "test-client-id"} should be "
test-client-id"'); | 109 'FetchEvent.clientId with option {clientId : "test-client-id"} should be "
test-client-id"'); |
101 assert_equals( | 110 assert_equals( |
102 new FetchEvent('FetchEvent', {request: req, isReload : true}).isReload, tr
ue, | 111 new FetchEvent('FetchEvent', {request: req, isReload : true}).isReload, tr
ue, |
103 'FetchEvent.isReload with option {isReload : true} should be true'); | 112 'FetchEvent.isReload with option {isReload : true} should be true'); |
104 assert_equals( | 113 assert_equals( |
105 new FetchEvent('FetchEvent', {request : req, isReload : true}).request.url
, | 114 new FetchEvent('FetchEvent', {request : req, isReload : true}).request.url
, |
106 'http://{{host}}/', | 115 'http://{{host}}/', |
107 'FetchEvent.request.url should return the value it was initialized to'); | 116 'FetchEvent.request.url should return the value it was initialized to'); |
108 }, 'Event constructors'); | 117 }, 'Event constructors'); |
OLD | NEW |