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

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

Issue 2627023002: Introduce Origin-Trial for Service Worker Navigation Preload (Closed)
Patch Set: s/an/a Created 3 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 <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 test(t => {
14 var interfaces =
15 get_interface_names(this, ['NavigationPreloadManager',
16 'FetchEvent',
17 'ServiceWorkerRegistration']);
18 console.log('Interfaces in document\n' + interfaces);
19 }, "Navigation preload related interfaces in Origin-Trial enabled document.");
20
21 function check_interfaces_in_sw(t, script, scope) {
22 var worker;
23 var message;
24 var registration;
25 return service_worker_unregister_and_register(t, script, scope)
26 .then(reg => {
27 registration = reg;
28 worker = registration.installing;
29 return wait_for_state(t, worker, 'activated');
30 })
31 .then(_ => {
32 var saw_message = new Promise(resolve => {
33 navigator.serviceWorker.onmessage =
34 e => { resolve(e.data); };
35 });
36 worker.postMessage("");
37 return saw_message;
38 })
39 .then(msg => {
40 message = msg;
41 return registration.unregister();
42 })
43 .then(_ => {
44 return message;
45 });
46 }
47
48 promise_test(t => {
49 var script =
50 './resources/navigation-preload-origin-trial-interfaces-worker.php';
51 var scope =
52 './resources/navigation-preload-origin-trial-interfaces-scope-normal';
53 return check_interfaces_in_sw(t, script, scope)
54 .then(message => {
55 console.log('Interfaces in normal Service Worker\n' + message);
56 });
57 }, "Navigation preload related interfaces in normal SW.");
58
59 promise_test(t => {
60 var script =
61 './resources/navigation-preload-origin-trial-interfaces-worker.php?' +
62 'origintrial=true';
63 var scope =
64 './resources/navigation-preload-origin-trial-interfaces-scope-enabled';
65 return check_interfaces_in_sw(t, script, scope)
66 .then(message => {
67 console.log('Interfaces in Origin-Trial enabled Service Worker\n' +
68 message);
69 });
70 }, "Navigation preload related interfaces in Origin-Trial enabled SW.");
71 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698