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

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/cast_extension_mock/load.js

Issue 505043002: Files.app Test: check the cast icon in drive volume (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define apiConfig property. Created 6 years, 4 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: chrome/test/data/extensions/api_test/file_manager_browsertest/cast_extension_mock/load.js
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/cast_extension_mock/load.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/cast_extension_mock/load.js
new file mode 100644
index 0000000000000000000000000000000000000000..0575a55dc99932d943018404b7f7e8746ca658a4
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/cast_extension_mock/load.js
@@ -0,0 +1,69 @@
+// Copyright 2014 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.
+
+'use strict';
+
+chrome.cast = {};
+
+/**
+ * @const
+ * @enum {string}
hirono 2014/08/26 05:59:01 Just for consistency: The order is usually @enum -
yoshiki 2014/08/26 06:11:01 Done.
+ */
+chrome.cast.ReceiverAvailability = {
+ UNAVAILABLE: 'unavailable',
+ AVAILABLE: 'available',
+};
+Object.freeze(chrome.cast.ReceiverAvailability);
+
+/**
+ * @constructor
+ */
+chrome.cast.SessionRequest = function() {
+};
+
+/**
+ * @constructor
hirono 2014/08/26 05:59:01 nit: @param
yoshiki 2014/08/26 06:11:01 Done.
+ */
+chrome.cast.ApiConfig = function(sessionRequest, onSession, onReceiver) {
+ this.onReceiver_ = onReceiver;
+
+ Object.seal(this);
+};
+
+/**
+ * @param {chrome.cast.ApiConfig} apiConfig
+ * @param {function()} onInitSuccess
+ * @param {function(chrome.cast.Error)} onError
+ */
+chrome.cast.initialize = function(apiConfig, onInitSuccess, onError) {
+ this.apiConfig_ = apiConfig;
+
+ var receiver1 = {friendlyName: 'test cast', label: 'testcast'};
+ var receivers = [receiver1];
+ setTimeout(this.apiConfig_.onReceiver.bind(
+ null, chrome.cast.ReceiverAvailability.UNAVAILABLE, []));
+ setTimeout(this.apiConfig_.onReceiver.bind(
+ null, chrome.cast.ReceiverAvailability.AVAILABLE, receivers), 1000);
+
+ onInitSuccess();
+};
+
+/**
+ * Initialized apiConfig value.
+ * @type {chrome.cast.ApiConfig}
+ * @private
+ */
+chrome.cast.apiConfig_ = null;
+
+/**
+ * @const
+ */
+chrome.cast.isAvailable = true;
+
+Object.freeze(chrome.cast);
+
+// Invokes the handler.
+if (window['__onGCastApiAvailable']) {
hirono 2014/08/26 05:59:01 {} is not needed.
yoshiki 2014/08/26 06:11:01 Done.
+ window['__onGCastApiAvailable'](true, null);
+}

Powered by Google App Engine
This is Rietveld 408576698