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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html

Issue 2571453002: Expose the BudgetService interface to Workers. (Closed)
Patch Set: Created 4 years 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
Index: third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html
new file mode 100644
index 0000000000000000000000000000000000000000..58d86b20b932bcb26e9028fe5d425ad252ecb622
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>getCost succeeds from a Service Worker</title>
Peter Beverloo 2016/12/12 14:28:43 nit: use a proper title. on line 34 too
harkness 2016/12/12 16:00:34 Done.
+ <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) {
+ var script = 'resources/instrumentation-service-worker.js';
+ var scope = 'resources/scope/' + location.pathname;
+ var port;
Peter Beverloo 2016/12/12 14:28:43 var -> const/let
harkness 2016/12/12 16:00:34 Done.
+
+ 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' });
+ })
+ .catch(unreached_rejection(test));
+ }, 'getCost should succeed from Service Worker');
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698