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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html
diff --git a/third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html b/third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html
new file mode 100644
index 0000000000000000000000000000000000000000..36e3123d96c25deeebc292a656197460fe7f3ec9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/presentation-service-mock.js"></script>
+<button>click me</button>
+<script>
+
+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
+ var button = document.querySelector('button');
+ button.addEventListener('click', callback, { once: true });
+
+ if (!('eventSender' in window))
+ return;
+
+ var boundingRect = button.getBoundingClientRect();
+ var x = boundingRect.left + boundingRect.width / 2;
+ var y = boundingRect.top + boundingRect.height / 2;
+
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+async_test(t => {
+ presentationServiceMock.then(t.step_func(mockService => {
+ 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
+ new PresentationRequest('https://example.com').start().then(
+ t.step_func_done(result => {
+ var e = new PresentationConnectionAvailableEvent(
+ '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
+ assert_not_equals(e, null);
+ assert_equals(e.connection, result);
+ }));
+ }));
+ }));
+}, "Test that the PresentationConnectionAvailableEvent ctor can take a valid PresentationConnection.")
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698