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

Unified Diff: LayoutTests/fast/notifications/resources/worker-tools.js

Issue 624033003: [WIP] Move Web Notifications to a WebFrame-less code path (Blink). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: current state Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/notifications/resources/notification-worker.js ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/notifications/resources/worker-tools.js
diff --git a/LayoutTests/fast/notifications/resources/worker-tools.js b/LayoutTests/fast/notifications/resources/worker-tools.js
new file mode 100644
index 0000000000000000000000000000000000000000..28c5d14007d07dde5c5d27c03c60e93939f3d2c7
--- /dev/null
+++ b/LayoutTests/fast/notifications/resources/worker-tools.js
@@ -0,0 +1,33 @@
+function startWorkerTest(script, type)
+{
+ var worker, messagePort;
+
+ switch (type) {
+ case 'dedicated':
+ worker = startWorker(script, false);
+ messagePort = worker;
+ break;
+ case 'shared':
+ worker = startWorker(script, true);
+ messagePort = worker.port;
+ break;
+ case 'service':
+ testFailed('Service Worker-based tests have not been implemented yet.');
+ return;
+ }
+
+ messagePort.addEventListener('message', function(event) {
+ if (event.data.length < 5 || event.data.charAt(4) == ':')
+ return; // this is a js-test.js message.
+
+ if (!window.testRunner)
+ return; // the test-runner is needed to provide automation.
+
+ var chunks = event.data.split('::');
+ switch (chunks[0]) {
+ case 'simulateClick':
+ testRunner.simulateWebNotificationClick(chunks[1]);
+ break;
+ }
+ });
+}
« no previous file with comments | « LayoutTests/fast/notifications/resources/notification-worker.js ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698