Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/interfaces-worker.js b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js |
similarity index 51% |
copy from third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/interfaces-worker.js |
copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js |
index 75ef8c6fa3c17161511b6f24f316fe28364103a7..e5ed36fcebafbccf98f26a367e93f6971aa32188 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/interfaces-worker.js |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js |
@@ -1,5 +1,6 @@ |
importScripts('interfaces.js'); |
importScripts('worker-testharness.js'); |
+importScripts('../resources/testharness-helpers.js'); |
var EVENT_HANDLER = 'object'; |
@@ -69,57 +70,38 @@ promise_test(function(t) { |
}, 'Cache'); |
test(function() { |
+ var req = new Request('http://{{host}}/', |
+ {method: 'POST', |
+ headers: [['Content-Type', 'Text/Html']]}); |
assert_equals( |
- new ExtendableEvent('ExtendableEvent').type, |
- 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); |
- assert_throws(new TypeError, function() { |
- new FetchEvent('FetchEvent'); |
- }, 'FetchEvent constructor with one argument throws'); |
- assert_throws(new TypeError, function() { |
- new FetchEvent('FetchEvent', {}); |
- }, 'FetchEvent constructor with empty init dict throws'); |
- assert_throws(new TypeError, function() { |
- new FetchEvent('FetchEvent', {request: null}); |
- }, 'FetchEvent constructor with null request member throws'); |
- var req = new Request('https://www.example.com/', {method: 'POST'}); |
+ new ExtendableEvent('ExtendableEvent').type, |
+ 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); |
assert_equals( |
- new FetchEvent('FetchEvent', {request: req}).type, |
- 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); |
+ new FetchEvent('FetchEvent', {request: req}).type, |
+ 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); |
assert_equals( |
- new FetchEvent('FetchEvent', {request: req}).cancelable, |
- false, 'Default FetchEvent.cancelable should be false'); |
+ new FetchEvent('FetchEvent', {request: req}).cancelable, |
+ false, 'Default FetchEvent.cancelable should be false'); |
assert_equals( |
- new FetchEvent('FetchEvent', {request: req}).bubbles, |
- false, 'Default FetchEvent.bubbles should be false'); |
+ new FetchEvent('FetchEvent', {request: req}).bubbles, |
+ false, 'Default FetchEvent.bubbles should be false'); |
assert_equals( |
- new FetchEvent('FetchEvent', {request: req}).clientId, |
- null, 'Default FetchEvent.clientId should be null'); |
+ new FetchEvent('FetchEvent', {request: req}).clientId, |
+ null, 'Default FetchEvent.clientId should be null'); |
assert_equals( |
- new FetchEvent('FetchEvent', {request: req}).isReload, |
- false, 'Default FetchEvent.isReload should be false'); |
+ new FetchEvent('FetchEvent', {request: req}).isReload, |
+ false, 'Default FetchEvent.isReload should be false'); |
assert_equals( |
- new FetchEvent( |
- 'FetchEvent', {request: req, cancelable: false}).cancelable, |
- false, 'FetchEvent.cancelable should be false'); |
+ new FetchEvent('FetchEvent', {request: req, cancelable: false}).cancelable, |
+ false, 'FetchEvent.cancelable should be false'); |
assert_equals( |
- new FetchEvent( |
- 'FetchEvent', |
- {request: req, |
- clientId: '006e6aae-cfd4-4331-bea8-fbae364703cf'}).clientId, |
- '006e6aae-cfd4-4331-bea8-fbae364703cf', |
- 'FetchEvent.clientId with option {clientId: string} should be ' + |
- 'the value of string'); |
+ new FetchEvent('FetchEvent', {request: req, clientId : 'test-client-id'}).clientId, 'test-client-id', |
+ 'FetchEvent.clientId with option {clientId : "test-client-id"} should be "test-client-id"'); |
assert_equals( |
- new FetchEvent( |
- 'FetchEvent', |
- {request: req, isReload: true}).isReload, |
- true, |
- 'FetchEvent.isReload with option {isReload: true} should be true'); |
+ new FetchEvent('FetchEvent', {request: req, isReload : true}).isReload, true, |
+ 'FetchEvent.isReload with option {isReload : true} should be true'); |
assert_equals( |
- new FetchEvent( |
- 'FetchEvent', |
- {request: req, isReload: true}).request.url, |
- 'https://www.example.com/', |
- 'FetchEvent.request.url should return the value it was ' + |
- 'initialized to'); |
+ new FetchEvent('FetchEvent', {request : req, isReload : true}).request.url, |
+ 'http://{{host}}/', |
+ 'FetchEvent.request.url should return the value it was initialized to'); |
}, 'Event constructors'); |