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

Side by Side Diff: LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html

Issue 491203002: [ServiceWorker] Add test for FetchEvent's body with a local file. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove test-helpers.js from iframe Created 6 years, 3 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
(Empty)
1 <script>
2 var port = undefined;
3 var scope = 'fetch-request-body-file-test';
4 var script = 'fetch-request-body-file-worker.js';
5
6 window.addEventListener('message', function(evt) {
7 port = evt.ports[0];
8 start();
9 }, false);
10
11 function wait_for_update(registration) {
12 return new Promise(function(resolve) {
13 registration.addEventListener('updatefound', function() {
14 resolve(registration.installing);
15 });
16 });
17 }
18
19 function wait_for_activated(worker) {
20 return new Promise(function(resolve) {
21 worker.addEventListener('statechange', function() {
22 if (worker.state == 'activated') {
23 resolve(worker);
24 }
25 });
26 });
27 }
28
29 function start() {
30 if (location.search == '?register') {
31 navigator.serviceWorker.register(script, {scope: scope})
32 .then(function(registration) {
33 return registration.unregister();
34 })
35 .then(function() {
36 return navigator.serviceWorker.register(script, {scope: scope});
37 })
38 .then(wait_for_update)
39 .then(wait_for_activated)
40 .then(function(worker) {
41 port.postMessage({msg: 'registered'});
42 });
43 } else if (location.search == '?unregister') {
44 navigator.serviceWorker.register(script, {scope: scope})
45 .then(function(registration) {
46 return registration.unregister();
47 })
48 .then(function() {
49 port.postMessage({msg: 'unregistered'});
50 });
51 }
52 }
53 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698