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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/clients-get.html

Issue 1439333002: Service Worker: Add Clients.get(id) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add layout test Created 4 years, 11 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 <!DOCTYPE html>
2 <title>Service Worker: Clients.get(id)</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7 var scope = 'resources/blank.html?clients-get';
8 var expected_client_url = new URL(scope + '#2', location).toString();
9
10 var frame1, frame2;
11 var worker;
12 promise_test(function(t) {
13 return service_worker_unregister_and_register(
14 t, 'resources/clients-get-worker.js', scope)
15 .then(function(registration) {
16 worker = registration.installing;
17 return wait_for_state(t, worker, 'activated');
18 })
19 .then(function() { return with_iframe(scope + '#1'); })
20 .then(function(f) {
21 frame1 = f;
22 return with_iframe(scope + '#2');
23 })
24 .then(function(f) {
25 frame2 = f;
26 return new Promise(function(resolve) {
27 // Make a subresource request in the second iframe (scope + '#2').
28 var xhr = new f.contentWindow.XMLHttpRequest();
29 xhr.onload = function() {
30 resolve();
31 };
32 xhr.open('GET', 'simple.txt');
33 xhr.send();
34 });
35 })
36 .then(function() {
37 return new Promise(function(resolve) {
38 var channel = new MessageChannel();
39 channel.port1.onmessage = resolve;
40 worker.postMessage({port:channel.port2}, [channel.port2]);
41 });
42 })
43 .then(function(message) {
44 assert_array_equals(message.data, expected_client_url);
45 frame1.remove();
46 frame2.remove();
47 return service_worker_unregister_and_done(t, scope);
48 })
49 }, 'Test Clients.get(id)');
50 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698