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

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: Added warning message 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..a568f514872d55f1859a39bb4a0c27225fb7814e
--- /dev/null
+++ b/extensions/test/data/api_test/display_source/api/background.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
Reilly Grant (use Gerrit) 2015/11/10 18:51:34 No "(c)" in new files.
Mikhail 2015/11/11 13:36:04 Done.
+// 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);
+ 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