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

Unified Diff: chrome/test/data/extensions/tray_cast/background.js

Issue 1307863004: Revert of Browser tests for the ChromeOS chromecast system tray item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 5 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/extensions/tray_cast/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/tray_cast/background.js
diff --git a/chrome/test/data/extensions/tray_cast/background.js b/chrome/test/data/extensions/tray_cast/background.js
index 2ea871a1ea412cff62369b1db7a9705e3a0eb713..51a4732bc1d4952265ca14b483bb02cc81cdc539 100644
--- a/chrome/test/data/extensions/tray_cast/background.js
+++ b/chrome/test/data/extensions/tray_cast/background.js
@@ -12,36 +12,47 @@
return null;
return {
- 'id': id,
- 'title': title,
- 'tabId': tabId
+ "id": id,
+ "title": title,
+ "tabId": tabId
};
}
var receiversActivities = [];
-var sendDevices = function() {
- chrome.cast.devicesPrivate.updateDevices(receiversActivities);
-}
-chrome.cast.devicesPrivate.updateDevicesRequested.addListener(sendDevices);
-
// Add a new receiver. |activityTitle| and |activityTabId| are optional
// parameters.
-var addReceiver = function(id, receiverName, activityTitle, activityTabId) {
+addReceiver = function(id, receiverName, activityTitle, activityTabId) {
receiversActivities.push({
- 'receiver': {
- 'id': id,
- 'name': receiverName
- },
- 'activity': tryCreateActivity_(id, activityTitle, activityTabId)
+ "activity": tryCreateActivity_(id, activityTitle, activityTabId),
+ "receiver": {
+ "id": id,
+ "name": receiverName
+ }
});
+}
+// Required API method.
+getMirrorCapableReceiversAndActivities = function() {
+ // For all of the API methods, we verify that |this| points to
+ // backgroundSetup. In the actual extension, the API methods are
+ // also free-standing but they are really class methods on backgroundSetup.
+ if (this !== backgroundSetup)
+ throw 'this !== backgroundSetup';
- sendDevices();
+ return receiversActivities;
}
+var stopMirroringReason = "";
var stopMirroringCalled = false;
-chrome.cast.devicesPrivate.stopCast.addListener(function(reason) {
- if (reason !== 'user-stop')
- throw 'expected reason to be "user-stop"';
+wasStopMirroringCalledWithUserStop = function() {
+ return stopMirroringCalled && stopMirroringReason == 'user-stop';
+}
+// Required API method.
+stopMirroring = function(reason) {
+ if (this !== backgroundSetup)
+ throw 'this !== backgroundSetup';
+
+ stopMirroringReason = reason;
+ stopMirroringCalled = true;
var foundActivity = false;
for (item of receiversActivities) {
@@ -52,25 +63,26 @@
}
if (foundActivity === false)
throw 'stopMirroring called when there was nothing being mirrored'
+}
- stopMirroringCalled = true;
- sendDevices();
-});
+var launchTabId = 1;
+var launchTabTitle = "Fake Cast";
+var launchDesktopMirroringReceiverId = "";
+getLaunchDesktopMirroringReceiverId = function() {
+ return launchDesktopMirroringReceiverId;
+}
+// Required API method.
+launchDesktopMirroring = function(receiverId) {
+ if (this !== backgroundSetup)
+ throw 'this !== backgroundSetup';
-
-var launchDesktopMirroringReceiverId = '';
-chrome.cast.devicesPrivate.startCast.addListener(function(receiverId) {
launchDesktopMirroringReceiverId = receiverId;
-
- var tabTitle = 'Tab Title';
- var tabId = 1;
for (item of receiversActivities) {
if (item.receiver.id == receiverId) {
- item.activity = tryCreateActivity_(receiverId, tabTitle, tabId);
+ item.activity =
+ tryCreateActivity_(receiverId, launchTabId, launchTabTitle);
break;
}
}
-
- sendDevices();
-});
+}
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/extensions/tray_cast/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698