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

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html

Issue 2491693003: Add tests for PresentationConnectionAvailable constructor. (Closed)
Patch Set: Created 4 years, 1 month 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 <html>
3 <body>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script src="../resources/mojo-helpers.js"></script>
7 <script src="resources/presentation-service-mock.js"></script>
8 <button>click me</button>
9 <script>
10
11 function waitForClick(callback) {
mark a. foltz 2016/11/15 18:50:07 This could return a Promise that is resolved by th
mlamouri (slow - plz ping) 2016/11/15 19:59:01 Actually, it doesn't work because the promise isn'
mark a. foltz 2016/11/15 20:49:20 I see. Can you add a comment that this function i
12 var button = document.querySelector('button');
13 button.addEventListener('click', callback, { once: true });
14
15 if (!('eventSender' in window))
16 return;
17
18 var boundingRect = button.getBoundingClientRect();
19 var x = boundingRect.left + boundingRect.width / 2;
20 var y = boundingRect.top + boundingRect.height / 2;
21
22 eventSender.mouseMoveTo(x, y);
23 eventSender.mouseDown();
24 eventSender.mouseUp();
25 }
26
27 async_test(t => {
28 presentationServiceMock.then(t.step_func(mockService => {
29 waitForClick(t.step_func(_ => {
mark a. foltz 2016/11/15 18:50:07 I'm a little fuzzy on when it's required to call t
mlamouri (slow - plz ping) 2016/11/15 19:59:01 I'm not sure what you mean by "chain up to ancesto
30 new PresentationRequest('https://example.com').start().then(
31 t.step_func_done(result => {
32 var e = new PresentationConnectionAvailableEvent(
33 'type', { connection: result });
mark a. foltz 2016/11/15 18:50:07 What is the 'type' argument for? It's not part of
mlamouri (slow - plz ping) 2016/11/15 19:59:01 The constructors have a `type` argument. See the c
mark a. foltz 2016/11/15 20:49:20 Can you pass the correct type name then (connectio
34 assert_not_equals(e, null);
35 assert_equals(e.connection, result);
36 }));
37 }));
38 }));
39 }, "Test that the PresentationConnectionAvailableEvent ctor can take a valid Pre sentationConnection.")
40
41 </script>
42 </body>
43 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698