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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 addAll: 'function', | 65 addAll: 'function', |
66 put: 'function', | 66 put: 'function', |
67 delete: 'function', | 67 delete: 'function', |
68 keys: 'function' | 68 keys: 'function' |
69 }); | 69 }); |
70 }); | 70 }); |
71 }, 'Cache'); | 71 }, 'Cache'); |
72 | 72 |
73 test(function() { | 73 test(function() { |
74 assert_equals( | 74 assert_equals( |
75 new ExtendableEvent('ExtendableEvent').type, | 75 new ExtendableEvent('ExtendableEvent').type, |
76 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); | 76 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); |
77 assert_equals( | |
78 new FetchEvent('FetchEvent').type, | |
79 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); | |
80 assert_equals( | |
81 new FetchEvent('FetchEvent').cancelable, | |
82 false, 'Default FetchEvent.cancelable should be false'); | |
83 assert_equals( | |
84 new FetchEvent('FetchEvent').bubbles, | |
85 false, 'Default FetchEvent.bubbles should be false'); | |
86 assert_equals( | |
87 new FetchEvent('FetchEvent').isReload, | |
88 false, 'Default FetchEvent.isReload should be false'); | |
89 assert_equals( | |
90 new FetchEvent('FetchEvent', {cancelable: false}).cancelable, | |
91 false, 'FetchEvent.cancelable should be false'); | |
92 assert_equals( | |
93 new FetchEvent('FetchEvent', {isReload : true}).isReload, true, | |
94 'FetchEvent.isReload with option {isReload : true} should be true'); | |
95 var req = new Request('https://www.example.com/', {method: 'POST'}); | 77 var req = new Request('https://www.example.com/', {method: 'POST'}); |
96 assert_equals( | 78 assert_equals( |
97 new FetchEvent('FetchEvent', {request: req, isReload: true}).request.url, | 79 new FetchEvent('FetchEvent', {request: req}).type, |
98 'https://www.example.com/', | 80 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); |
99 'FetchEvent.request.url should return the value it was initialized to'); | 81 assert_equals( |
| 82 new FetchEvent('FetchEvent', {request: req}).cancelable, |
| 83 false, 'Default FetchEvent.cancelable should be false'); |
| 84 assert_equals( |
| 85 new FetchEvent('FetchEvent', {request: req}).bubbles, |
| 86 false, 'Default FetchEvent.bubbles should be false'); |
| 87 assert_equals( |
| 88 new FetchEvent('FetchEvent', {request: req}).clientId, |
| 89 null, 'Default FetchEvent.clientId should be null'); |
| 90 assert_equals( |
| 91 new FetchEvent('FetchEvent', {request: req}).isReload, |
| 92 false, 'Default FetchEvent.isReload should be false'); |
| 93 assert_equals( |
| 94 new FetchEvent( |
| 95 'FetchEvent', {request: req, cancelable: false}).cancelable, |
| 96 false, 'FetchEvent.cancelable should be false'); |
| 97 assert_equals( |
| 98 new FetchEvent( |
| 99 'FetchEvent', |
| 100 {request: req, |
| 101 clientId: '006e6aae-cfd4-4331-bea8-fbae364703cf'}).clientId, |
| 102 '006e6aae-cfd4-4331-bea8-fbae364703cf', |
| 103 'FetchEvent.clientId with option {clientId: string} should be ' + |
| 104 'the value of string'); |
| 105 assert_equals( |
| 106 new FetchEvent( |
| 107 'FetchEvent', |
| 108 {request: req, isReload: true}).isReload, |
| 109 true, |
| 110 'FetchEvent.isReload with option {isReload: true} should be true'); |
| 111 assert_equals( |
| 112 new FetchEvent( |
| 113 'FetchEvent', |
| 114 {request: req, isReload: true}).request.url, |
| 115 'https://www.example.com/', |
| 116 'FetchEvent.request.url should return the value it was ' + |
| 117 'initialized to'); |
100 }, 'Event constructors'); | 118 }, 'Event constructors'); |
OLD | NEW |