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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/notifications/resources/test-helpers.js

Issue 1644063002: Simplify TestRunnerBindings::SimulateWebNotificationClick param handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
1 // Supports test-runner control messages being send over |messagePort|, which en able 1 // Supports test-runner control messages being send over |messagePort|, which en able
2 // workers to have limited access to TestRunner methods. 2 // workers to have limited access to TestRunner methods.
3 function supportTestRunnerMessagesOnPort(messagePort) 3 function supportTestRunnerMessagesOnPort(messagePort)
4 { 4 {
5 if (!window.testRunner) 5 if (!window.testRunner)
6 return; 6 return;
7 7
8 messagePort.addEventListener('message', function(message) { 8 messagePort.addEventListener('message', function(message) {
9 if (message.data.type == 'simulateWebNotificationClick') 9 if (message.data.type == 'simulateWebNotificationClick')
10 testRunner.simulateWebNotificationClick(message.data.title); 10 testRunner.simulateWebNotificationClick(message.data.title, -1 /* ac tion_index */);
11 }); 11 });
12 } 12 }
13 13
14 // Starts |script| as a dedicated worker and executes the testharness tests defi ned 14 // Starts |script| as a dedicated worker and executes the testharness tests defi ned
15 // within it. The Notification-related testRunner methods will be made available . 15 // within it. The Notification-related testRunner methods will be made available .
16 function dedicatedWorkerTest(script) 16 function dedicatedWorkerTest(script)
17 { 17 {
18 var worker = new Worker(script); 18 var worker = new Worker(script);
19 supportTestRunnerMessagesOnPort(worker); 19 supportTestRunnerMessagesOnPort(worker);
20 20
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 messageChannel.port1.addEventListener('message', function(event) { 59 messageChannel.port1.addEventListener('message', function(event) {
60 if (event.data == 'ready') 60 if (event.data == 'ready')
61 resolve({ registration: registration, port: messageChannel.p ort1 }); 61 resolve({ registration: registration, port: messageChannel.p ort1 });
62 }); 62 });
63 63
64 registration.active.postMessage(messageChannel.port2, [messageChanne l.port2]); 64 registration.active.postMessage(messageChannel.port2, [messageChanne l.port2]);
65 messageChannel.port1.start(); 65 messageChannel.port1.start();
66 }); 66 });
67 }); 67 });
68 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698