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

Unified Diff: chrome/test/data/webui/media_router/route_details_tests.js

Issue 2040883002: [Media Router] Assign each route a current cast mode if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for WebUI::CallJavascriptFunction rename Created 4 years, 6 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/test/data/webui/media_router/media_router_container_test_base.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/media_router/route_details_tests.js
diff --git a/chrome/test/data/webui/media_router/route_details_tests.js b/chrome/test/data/webui/media_router/route_details_tests.js
index 5381479479f27a0a65ae4246476007828c8cf30f..c4cd0b8e1d83985bafcd9d6b943b7f3eafe8568e 100644
--- a/chrome/test/data/webui/media_router/route_details_tests.js
+++ b/chrome/test/data/webui/media_router/route_details_tests.js
@@ -61,6 +61,12 @@ cr.define('route_details', function() {
assertEquals(expected, details.$[elementId].innerText);
};
+ /**
+ * Fake sink that corresponds to |fakeRouteOne|.
+ * @type {media_router.Sink}
+ */
+ var fakeSinkOne;
+
// Import route_details.html before running suite.
suiteSetup(function() {
return PolymerTest.importHtml(
@@ -80,6 +86,10 @@ cr.define('route_details', function() {
'chrome-extension://123/custom_view.html');
fakeRouteTwo = new media_router.Route('route id 2', 'sink id 2',
'Video 2', 2, false, true);
+ fakeSinkOne = new media_router.Sink(
+ 'sink id 1', 'sink 1', 'description', null,
+ media_router.SinkIconType.CAST, media_router.SinkStatus.ACTIVE,
+ 2 | 4);
// Allow for the route details to be created and attached.
setTimeout(done);
@@ -92,12 +102,35 @@ cr.define('route_details', function() {
details.route = fakeRouteTwo;
checkStartCastButtonIsShown();
- details.availableCastModes = 1;
- details.replaceRouteAvailable = false;
details.route = fakeRouteOne;
checkStartCastButtonIsNotShown();
- details.replaceRouteAvailable = true;
+ details.sink = fakeSinkOne;
+ checkStartCastButtonIsShown();
+
+ // Retrigger observer because it's not necessary for it to watch
+ // |route.currentCastMode| in general.
+ fakeRouteOne.currentCastMode = 2;
+ details.route = null;
+ details.route = fakeRouteOne;
+ checkStartCastButtonIsNotShown();
+
+ // Simulate user changing cast modes to be compatible or incompatible
+ // with the route's sink.
+ details.shownCastModeValue = 4;
+ checkStartCastButtonIsShown();
+
+ details.shownCastModeValue = 1;
+ checkStartCastButtonIsNotShown();
+
+ details.shownCastModeValue = 4;
+ checkStartCastButtonIsShown();
+
+ // Cast button should be hidden while another sink is launching.
+ details.isAnySinkCurrentlyLaunching = true;
+ checkStartCastButtonIsNotShown();
+
+ details.isAnySinkCurrentlyLaunching = false;
checkStartCastButtonIsShown();
});
@@ -145,7 +178,6 @@ cr.define('route_details', function() {
test('route is undefined or set', function() {
// |route| is initially undefined.
assertEquals(undefined, details.route);
- assertEquals(0, details.availableCastModes);
checkDefaultViewIsShown();
// Set |route|.
@@ -165,23 +197,6 @@ cr.define('route_details', function() {
checkStartCastButtonIsShown();
});
- // Tests when |availableCastModes| is undefined or set.
- test('route available cast modes undefined or set', function() {
- details.route = fakeRouteOne;
- assertEquals(0, details.availableCastModes);
- assertFalse(details.route.canJoin);
- checkStartCastButtonIsNotShown();
-
- details.availableCastModes = 1;
- checkStartCastButtonIsShown();
-
- details.availableCastModes = 2;
- checkStartCastButtonIsShown();
-
- details.availableCastModes = 3;
- checkStartCastButtonIsShown();
- });
-
// Tests when |route| exists, has a custom controller, and it loads.
test('route has custom controller and loading succeeds', function(done) {
var loadInvoked = false;
« no previous file with comments | « chrome/test/data/webui/media_router/media_router_container_test_base.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698