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

Unified Diff: third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html

Issue 2706453002: [Presentation API] return valid WebPresentationConnection object in PresentationReceiver (Closed)
Patch Set: add layout test for receiver.connectionList Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html
diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html b/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html
new file mode 100644
index 0000000000000000000000000000000000000000..bf12e3ef3eae721f79df61bbe655e90faf0a0253
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html
@@ -0,0 +1,38 @@
+<!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>
+<script>
+
+async_test(t => {
+ internals.settings.setPresentationReceiver(true);
+ t.add_cleanup(_ => { internals.settings.setPresentationReceiver(false); });
+
+ presentationServiceMock.then(mockService => {
+ // Invoke mockService.setClient().
+ var receiver = navigator.presentation.receiver;
mark a. foltz 2017/02/21 17:47:38 s/var/const/
zhaobin 2017/02/21 19:11:38 Done.
+
+ // Make sure it is invoked after calling setClient().
+ setTimeout(() => {
mark a. foltz 2017/02/21 17:47:38 Does the rest of the test need to be in an event h
zhaobin 2017/02/21 19:11:38 Yes, put them in an event handler to make sure thi
+ const url = 'http://example.com/a.html';
+ const id = 'fakeSessionId';
+ mockService.onReceiverConnectionAvailable(url, id);
+
+ receiver.connectionList.then(
+ t.step_func_done(list => {
+ assert_equals(list.connections.length, 1);
+ list.connections.map(connection => {
mark a. foltz 2017/02/21 17:47:38 Since the length is 1, you could just write asser
zhaobin 2017/02/21 19:11:38 Done.
+ assert_equals(connection.url, url);
+ assert_equals(connection.id, id);
+ });
+ }));
+ });
+ });
+}, "Test presetnation.receiver.connectionList resolves with incoming connection.");
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698