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

Unified Diff: extensions/test/data/api_test/display_source/api/background.js

Issue 1410093008: Introduce chrome.displaySource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from Antony Created 5 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: extensions/test/data/api_test/display_source/api/background.js
diff --git a/extensions/test/data/api_test/display_source/api/background.js b/extensions/test/data/api_test/display_source/api/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..0a73e3f2aa177ee3150b3bee7f4eeaa6f13fc724
--- /dev/null
+++ b/extensions/test/data/api_test/display_source/api/background.js
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var testGetAvailableSinks = function() {
+ var callback = function(sinks) {
+ chrome.test.assertEq(1, sinks.length);
+ var sink = sinks[0];
+ chrome.test.assertEq(1, sink.id);
+ chrome.test.assertEq("sink 1", sink.name);
asargent_no_longer_on_chrome 2015/11/17 00:51:56 consider also testing that 'state' is disconnected
Mikhail 2015/11/17 14:07:42 Done.
+ chrome.test.succeed("GetAvailableSinks succeded");
+ };
+ chrome.displaySource.getAvailableSinks(callback);
+};
+
+var testOnSinksUpdated = function() {
+ var callback = function(sinks) {
+ chrome.test.assertEq(2, sinks.length);
+ var sink = sinks[1];
+ chrome.test.assertEq(2, sink.id);
+ chrome.test.assertEq("sink 2", sink.name);
+ chrome.test.succeed("onSinksUpdated event delivered");
+ };
+ chrome.displaySource.onSinksUpdated.addListener(callback);
+};
+
+var testRequestAuthentication = function() {
+ var callback = function(auth_info) {
+ chrome.test.assertEq("PBC", auth_info.method);
+ chrome.test.succeed("RequestAuthentication succeded");
+ };
+ chrome.displaySource.requestAuthentication(1, callback);
+};
+
+chrome.test.runTests([testGetAvailableSinks,
+ testOnSinksUpdated,
+ testRequestAuthentication]);

Powered by Google App Engine
This is Rietveld 408576698