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

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

Issue 2938173004: [Media Router] Add a supports_web_ui_controller attribute to MediaRoute (Closed)
Patch Set: Created 3 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/renderer/resources/extensions/media_router_bindings.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/media_router_container_route_tests.js
diff --git a/chrome/test/data/webui/media_router/media_router_container_route_tests.js b/chrome/test/data/webui/media_router/media_router_container_route_tests.js
index 110302cb1ade98902dc56509a7a82197ca41f05f..115aeca6b234ca6d8618c8443504a9f3ea7a1b97 100644
--- a/chrome/test/data/webui/media_router/media_router_container_route_tests.js
+++ b/chrome/test/data/webui/media_router/media_router_container_route_tests.js
@@ -79,6 +79,28 @@ cr.define('media_router_container_route', function() {
*/
var fakeSinkList = [];
+ /**
+ * Sets |container| to use |fakeSinkList| and |fakeRouteList|, and chooses
+ * the sink at the index.
+ * @param {number} index
+ * @return {!Promise<void>}
+ */
+ var chooseSinkAtIndex = function(index) {
+ container.allSinks = fakeSinkList;
+ container.routeList = fakeRouteList;
+ return new Promise(function(resolve) {
+ setTimeout(function() {
+ var sinkList = container.shadowRoot.getElementById('sink-list')
+ .querySelectorAll('paper-item');
+ // Start from the SINK_LIST view.
+ container.showSinkList_();
+ checkCurrentView(media_router.MediaRouterView.SINK_LIST);
+ MockInteractions.tap(sinkList[index]);
+ resolve();
+ });
+ });
+ };
+
// Import media_router_container.html before running suite.
suiteSetup(function() {
return PolymerTest.importHtml(
@@ -145,23 +167,46 @@ cr.define('media_router_container_route', function() {
// Tests that selecting a sink with an associated route will make the
// |container| switch to ROUTE_DETAILS view.
test('select sink with a route', function(done) {
- container.allSinks = fakeSinkList;
- container.routeList = fakeRouteList;
-
- setTimeout(function() {
- var sinkList =
- container.shadowRoot.getElementById('sink-list')
- .querySelectorAll('paper-item');
-
- // Start from the SINK_LIST view.
- container.showSinkList_();
- checkCurrentView(media_router.MediaRouterView.SINK_LIST);
- MockInteractions.tap(sinkList[0]);
+ chooseSinkAtIndex(0).then(function() {
checkCurrentView(media_router.MediaRouterView.ROUTE_DETAILS);
done();
});
});
+ test('uses WebUI controls when they are available', function(done) {
+ var index = 0;
+ container.webUiRouteControlsAvailable = true;
+ fakeRouteList[index].supportsWebUiController = true;
+ chooseSinkAtIndex(index).then(function() {
+ assertTrue(container.useWebUiRouteControls);
+ done();
+ });
+ });
+
+ test(
+ 'does not use WebUI controls when they are not available',
+ function(done) {
+ var index = 0;
+ container.webUiRouteControlsAvailable = false;
+ fakeRouteList[index].supportsWebUiController = true;
+ chooseSinkAtIndex(index).then(function() {
+ assertFalse(container.useWebUiRouteControls);
+ done();
+ });
+ });
+
+ test(
+ 'does not use WebUI controls when the route does not support them',
+ function(done) {
+ var index = 0;
+ container.webUiRouteControlsAvailable = true;
+ fakeRouteList[index].supportsWebUiController = false;
+ chooseSinkAtIndex(index).then(function() {
+ assertFalse(container.useWebUiRouteControls);
+ done();
+ });
+ });
takumif 2017/06/15 21:59:41 Hmm I'm not super happy with how the code is forma
+
// Tests the text shown for the sink list.
test('initial sink list route text', function(done) {
// Sink 1 - no sink description, no route -> no subtext
« no previous file with comments | « chrome/renderer/resources/extensions/media_router_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698