Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4
4 var EVENT_HANDLER = 'object'; 5 var EVENT_HANDLER = 'object';
5 6
6 test(function() { 7 test(function() {
7 verify_interface('ServiceWorkerGlobalScope', 8 verify_interface('ServiceWorkerGlobalScope',
8 self, 9 self,
9 { 10 {
10 clients: 'object', 11 clients: 'object',
11 registration: 'object', 12 registration: 'object',
12 skipWaiting: 'function', 13 skipWaiting: 'function',
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 add: 'function', 63 add: 'function',
63 addAll: 'function', 64 addAll: 'function',
64 put: 'function', 65 put: 'function',
65 delete: 'function', 66 delete: 'function',
66 keys: 'function' 67 keys: 'function'
67 }); 68 });
68 }); 69 });
69 }, 'Cache'); 70 }, 'Cache');
70 71
71 test(function() { 72 test(function() {
73 var req = new Request('http://{{host}}/',
74 {method: 'POST',
75 headers: [['Content-Type', 'Text/Html']]});
72 assert_equals( 76 assert_equals(
73 new ExtendableEvent('ExtendableEvent').type, 77 new ExtendableEvent('ExtendableEvent').type,
74 'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent'); 78 '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');
84 var req = new Request('https://www.example.com/', {method: 'POST'});
85 assert_equals( 79 assert_equals(
86 new FetchEvent('FetchEvent', {request: req}).type, 80 new FetchEvent('FetchEvent', {request: req}).type,
87 'FetchEvent', 'Type of FetchEvent should be FetchEvent'); 81 'FetchEvent', 'Type of FetchEvent should be FetchEvent');
88 assert_equals( 82 assert_equals(
89 new FetchEvent('FetchEvent', {request: req}).cancelable, 83 new FetchEvent('FetchEvent', {request: req}).cancelable,
90 false, 'Default FetchEvent.cancelable should be false'); 84 false, 'Default FetchEvent.cancelable should be false');
91 assert_equals( 85 assert_equals(
92 new FetchEvent('FetchEvent', {request: req}).bubbles, 86 new FetchEvent('FetchEvent', {request: req}).bubbles,
93 false, 'Default FetchEvent.bubbles should be false'); 87 false, 'Default FetchEvent.bubbles should be false');
94 assert_equals( 88 assert_equals(
95 new FetchEvent('FetchEvent', {request: req}).clientId, 89 new FetchEvent('FetchEvent', {request: req}).clientId,
96 null, 'Default FetchEvent.clientId should be null'); 90 null, 'Default FetchEvent.clientId should be null');
97 assert_equals( 91 assert_equals(
98 new FetchEvent('FetchEvent', {request: req}).isReload, 92 new FetchEvent('FetchEvent', {request: req}).isReload,
99 false, 'Default FetchEvent.isReload should be false'); 93 false, 'Default FetchEvent.isReload should be false');
100 assert_equals( 94 assert_equals(
101 new FetchEvent( 95 new FetchEvent('FetchEvent', {request: req, cancelable: false}).cancelable ,
102 'FetchEvent', {request: req, cancelable: false}).cancelable, 96 false, 'FetchEvent.cancelable should be false');
103 false, 'FetchEvent.cancelable should be false');
104 assert_equals( 97 assert_equals(
105 new FetchEvent( 98 new FetchEvent('FetchEvent', {request: req, clientId : 'test-client-id'}). clientId, 'test-client-id',
106 'FetchEvent', 99 'FetchEvent.clientId with option {clientId : "test-client-id"} should be " test-client-id"');
107 {request: req,
108 clientId: '006e6aae-cfd4-4331-bea8-fbae364703cf'}).clientId,
109 '006e6aae-cfd4-4331-bea8-fbae364703cf',
110 'FetchEvent.clientId with option {clientId: string} should be ' +
111 'the value of string');
112 assert_equals( 100 assert_equals(
113 new FetchEvent( 101 new FetchEvent('FetchEvent', {request: req, isReload : true}).isReload, tr ue,
114 'FetchEvent', 102 'FetchEvent.isReload with option {isReload : true} should be true');
115 {request: req, isReload: true}).isReload,
116 true,
117 'FetchEvent.isReload with option {isReload: true} should be true');
118 assert_equals( 103 assert_equals(
119 new FetchEvent( 104 new FetchEvent('FetchEvent', {request : req, isReload : true}).request.url ,
120 'FetchEvent', 105 'http://{{host}}/',
121 {request: req, isReload: true}).request.url, 106 'FetchEvent.request.url should return the value it was initialized to');
122 'https://www.example.com/',
123 'FetchEvent.request.url should return the value it was ' +
124 'initialized to');
125 }, 'Event constructors'); 107 }, 'Event constructors');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698