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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces.html

Issue 2811063002: Enable ServiceWorkerNavigationPreload by default (Closed)
Patch Set: rebase Created 3 years, 8 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 <meta charset="utf-8">
3 <!-- Generate these token with the commands:
4 generate_token.py http://127.0.0.1:8000 ServiceWorkerNavigationPreload -expire- timestamp=2000000000
5 -->
6 <meta http-equiv="origin-trial" content="AsAA4dg2Rm+GSgnpyxxnpVk1Bk8CcE+qVBTDpPb IFNscyNRJOdqw1l0vkC4dtsGm1tmP4ZDAKwycQDzsc9xr7gMAAABmeyJvcmlnaW4iOiAiaHR0cDovLzE yNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiU2VydmljZVdvcmtlck5hdmlnYXRpb25QcmVsb2FkIiw gImV4cGlyeSI6IDIwMDAwMDAwMDB9" />
7 <title>Navigation Preload origin trial</title>
8 <script src="../../resources/testharness.js"></script>
9 <script src="../../resources/testharnessreport.js"></script>
10 <script src="../resources/test-helpers.js"></script>
11 <script src="./resources/get-interface-names.js"></script>
12 <script>
13 console.warn('This test relies on console message comparison so there can ' +
14 'be different -expected.txt files for virtual test suites.');
15
16 test(t => {
17 var interfaces =
18 get_interface_names(this, ['NavigationPreloadManager',
19 'FetchEvent',
20 'ServiceWorkerRegistration']);
21 console.log('Interfaces in document\n' + interfaces);
22 }, "Navigation preload related interfaces in Origin-Trial enabled document.");
23
24 function check_interfaces_in_sw(t, script, scope) {
25 var worker;
26 var message;
27 var registration;
28 return service_worker_unregister_and_register(t, script, scope)
29 .then(reg => {
30 registration = reg;
31 worker = registration.installing;
32 return wait_for_state(t, worker, 'activated');
33 })
34 .then(_ => {
35 var saw_message = new Promise(resolve => {
36 navigator.serviceWorker.onmessage =
37 e => { resolve(e.data); };
38 });
39 worker.postMessage("");
40 return saw_message;
41 })
42 .then(msg => {
43 message = msg;
44 return registration.unregister();
45 })
46 .then(_ => {
47 return message;
48 });
49 }
50
51 promise_test(t => {
52 var script =
53 './resources/navigation-preload-origin-trial-interfaces-worker.php';
54 var scope =
55 './resources/navigation-preload-origin-trial-interfaces-scope-normal';
56 return check_interfaces_in_sw(t, script, scope)
57 .then(message => {
58 console.log('Interfaces in normal Service Worker\n' + message);
59 });
60 }, "Navigation preload related interfaces in normal SW.");
61
62 promise_test(t => {
63 var script =
64 './resources/navigation-preload-origin-trial-interfaces-worker.php?' +
65 'origintrial=true';
66 var scope =
67 './resources/navigation-preload-origin-trial-interfaces-scope-enabled';
68 return check_interfaces_in_sw(t, script, scope)
69 .then(message => {
70 console.log('Interfaces in Origin-Trial enabled Service Worker\n' +
71 message);
72 });
73 }, "Navigation preload related interfaces in Origin-Trial enabled SW.");
74 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698