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

Unified 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: incorporated nhiroki's comment Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html
diff --git a/LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html b/LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..604532028e1f386e4db1b2dfba12fcf55c229196
--- /dev/null
+++ b/LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html
@@ -0,0 +1,42 @@
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../serviceworker/resources/test-helpers.js?pipe=sub"></script>
+<script>
+var port = undefined;
+var scope = 'fetch-request-body-file-test';
+var script = 'fetch-request-body-file-worker.js';
+
+window.addEventListener('message', function(evt) {
+ port = evt.ports[0];
+ start();
+ }, false);
+
+function start() {
+ if (location.search == '?register') {
+ async_test(function(t) {
nhiroki 2014/08/27 03:52:34 Would it be possible to remove async_test() from h
horo 2014/08/27 05:05:45 I introduced this in order to use wait_for_update
nhiroki 2014/08/27 05:23:21 I see... I didn't mean to reuse the wait_for_updat
horo 2014/08/27 06:01:54 Done.
+ service_worker_unregister_and_register(t, script, scope)
nhiroki 2014/08/27 03:52:34 Question: Why don't you call register()/unregister
horo 2014/08/27 05:05:45 In layouttest, fetch-request-body-file.html is ope
nhiroki 2014/08/27 05:23:21 Acknowledged.
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
+ .then(function(worker) {
+ port.postMessage({msg: 'registered'});
+ })
+ .catch(function() {
+ port.postMessage({msg: 'registration error'});
+ });
+ }, 'Register ServiceWorker');
+ } else if (location.search == '?unregister') {
+ async_test(function(t) {
nhiroki 2014/08/27 03:52:34 ditto (removing async_test).
+ navigator.serviceWorker.register(script, {scope: scope})
+ .then(function(registration) {
+ return registration.unregister();
+ })
+ .then(function() {
+ port.postMessage({msg: 'unregistered'});
+ })
+ .catch(function() {
+ port.postMessage({msg: 'unregistration error'});
+ });
+ }, 'Unregister ServiceWorker');
+ }
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698