Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/origin_trials/webexposed/budget-origin-trial-interfaces-in-service-worker.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/origin_trials/webexposed/budget-origin-trial-interfaces-in-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/origin_trials/webexposed/budget-origin-trial-interfaces-in-service-worker.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c04fc35a0aa726fe5801bbc312e6d1e0c7754642 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/origin_trials/webexposed/budget-origin-trial-interfaces-in-service-worker.html |
| @@ -0,0 +1,40 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <head> |
| + <!-- Generate token with the command: |
| + generate_token.py http://127.0.0.1:8000 BudgetQuery --expire-timestamp=2000000000 |
| + -- --> |
| + <meta http-equiv="origin-trial" content="AgFtR2Ps1Z9M/FW14Tgcwbajvq7kvzc/b1SPPSaaucG/P4ba6xC/69I9v8Pqx4wbsJINoqMabs9GE/LxOnPRfQIAAABTeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQnVkZ2V0UXVlcnkiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0" /> |
|
Peter Beverloo
2017/04/24 14:24:01
Ian, how does this work? The Service Worker will b
iclelland
2017/04/24 14:45:33
If this test is passing, and it appears that the t
|
| + <title>Budget interfaces available in a Service Worker</title> |
| + <script src="../../resources/testharness.js"></script> |
| + <script src="../../resources/testharnessreport.js"></script> |
| + <script src="../../serviceworker/resources/test-helpers.js"></script> |
| + <script src="../../notifications/resources/test-helpers.js"></script> |
| + </head> |
| + <body> |
| + <script> |
| + promise_test(function(test) { |
| + const script = '../../budget/resources/instrumentation-service-worker.js'; |
| + const scope = '../../budget/resources/scope/' + location.pathname; |
| + let port; |
|
Peter Beverloo
2017/04/24 14:24:01
nit: |port| can be local to the function on line 2
|
| + |
| + return getActiveServiceWorkerWithMessagePort(test, script, scope) |
| + .then(function(workerInfo) { |
| + port = workerInfo.port; |
| + |
| + port.addEventListener('message', function(event) { |
| + if (typeof event.data != 'object' || !event.data.command) |
| + assert_unreached('Invalid message from the service worker'); |
| + |
| + assert_equals(event.data.command, 'checkInterfaces'); |
| + assert_true(event.data.success, |
| + 'checkInterfaces should succeed but failed with error: ' + |
| + event.data.message); |
| + }); |
| + |
| + return sendCommand(port, { command: 'checkInterfaces' }); |
|
Peter Beverloo
2017/04/24 14:24:01
Are we sure that the event listener on line 25 is
|
| + }) |
| + }, 'BudgetQuery interfaces should be available in a Service Worker.'); |
| + </script> |
| + </body> |
| +</html> |