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

Unified Diff: LayoutTests/http/tests/serviceworker/fetch.html

Issue 318393002: Initial implementation of ServiceWorkerGlobalScope.fetch() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incoroporated dominicc's comment Created 6 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/fetch-event.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/fetch.html
diff --git a/LayoutTests/http/tests/serviceworker/postmessage.html b/LayoutTests/http/tests/serviceworker/fetch.html
similarity index 67%
copy from LayoutTests/http/tests/serviceworker/postmessage.html
copy to LayoutTests/http/tests/serviceworker/fetch.html
index 951bd8d00692754ee2b22ffa61e8ebed5b4d7b81..8aac1e161797851183ecd254fc379b17190b54ce 100644
--- a/LayoutTests/http/tests/serviceworker/postmessage.html
+++ b/LayoutTests/http/tests/serviceworker/fetch.html
@@ -1,40 +1,36 @@
<!DOCTYPE html>
-<title>Service Worker: postMessage</title>
+<title>Service Worker: fetch()</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
-var test = async_test('postMessage to a ServiceWorker (and back via MessagePort)');
+var test = async_test('Verify fetch() in a Service Worker');
test.step(function() {
var scope = 'resources/blank.html';
service_worker_unregister_and_register(
- test, 'resources/postmessage-worker.js', scope, onRegister);
+ test, 'resources/fetch-worker.js', scope, onRegister);
function onRegister(worker) {
var messageChannel = new MessageChannel();
messageChannel.port1.onmessage = test.step_func(onMessage);
-
worker.postMessage({port: messageChannel.port2}, [messageChannel.port2]);
-
- worker.postMessage({value: 1});
- worker.postMessage({value: 2});
- worker.postMessage({done: true});
- };
+ }
var result = [];
var expected = [
- 'Acking value: 1',
- 'Acking value: 2',
+ 'Resolved: other.html',
+ 'Rejected: http:// : Invalid URL',
+ 'Rejected: http://www.example.com/foo : Failed to fetch',
];
function onMessage(e) {
var message = e.data;
- if (message === 'quit') {
+ if (message == 'quit') {
assert_array_equals(result, expected, 'Worker should post back expected values.');
service_worker_unregister_and_done(test, scope);
} else {
result.push(message);
}
- };
+ }
});
</script>
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/fetch-event.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698