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

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

Issue 2938173004: [Media Router] Add a supports_web_ui_controller attribute to MediaRoute (Closed)
Patch Set: Rebase 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/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 17451ad511f1fb1050c1f49da766b12d0f197f2d..a07cbb617fb44cf410bdab12ff01aef59954feaf 100644
--- a/chrome/test/data/webui/media_router/route_details_tests.js
+++ b/chrome/test/data/webui/media_router/route_details_tests.js
@@ -48,7 +48,9 @@ cr.define('route_details', function() {
// Checks the default route view is shown.
var checkDefaultViewIsShown = function() {
assertFalse(details.$$('#route-information').hasAttribute('hidden'));
- assertTrue(details.$$('extension-view-wrapper').hasAttribute('hidden'));
+ assertTrue(
+ !details.$$('extension-view-wrapper') ||
+ details.$$('extension-view-wrapper').hasAttribute('hidden'));
};
// Checks the start button is shown.
@@ -87,7 +89,6 @@ cr.define('route_details', function() {
setup(function(done) {
PolymerTest.clearBody();
details = document.createElement('route-details');
- details.useWebUiRouteControls = false;
document.body.appendChild(details);
// Initialize routes and sinks.
@@ -209,33 +210,45 @@ cr.define('route_details', function() {
// Tests when |route| exists, has a custom controller, and it loads.
test('route has custom controller and loading succeeds', function(done) {
- details.$$('extension-view-wrapper').$$('#custom-controller').load =
- function(url) {
- setTimeout(function() {
- assertEquals(
- fakeRouteOneControllerPath,
- url.substring(0, fakeRouteOneControllerPath.length));
- checkCustomControllerIsShown();
- done();
- });
- return Promise.resolve();
- };
+ // Get the extension-view-wrapper stamped first, so that we can mock out
+ // the load method.
+ details.route = fakeRouteTwo;
- details.route = fakeRouteOne;
+ setTimeout(function() {
+ details.$$('extension-view-wrapper').$$('#custom-controller').load =
+ function(url) {
+ setTimeout(function() {
+ assertEquals(
+ fakeRouteOneControllerPath,
+ url.substring(0, fakeRouteOneControllerPath.length));
+ checkCustomControllerIsShown();
+ done();
+ });
+ return Promise.resolve();
+ };
+
+ details.route = fakeRouteOne;
+ });
});
// Tests when |route| exists, has a custom controller, but fails to load.
test('route has custom controller but loading fails', function(done) {
- details.$$('extension-view-wrapper').$$('#custom-controller').load =
- function(url) {
- setTimeout(function() {
- checkDefaultViewIsShown();
- done();
- });
- return Promise.reject();
- };
+ // Get the extension-view-wrapper stamped first, so that we can mock out
+ // the load method.
+ details.route = fakeRouteTwo;
- details.route = fakeRouteOne;
+ setTimeout(function() {
+ details.$$('extension-view-wrapper').$$('#custom-controller').load =
+ function(url) {
+ setTimeout(function() {
+ checkDefaultViewIsShown();
+ done();
+ });
+ return Promise.reject();
+ };
+
+ details.route = fakeRouteOne;
+ });
});
});
}
« 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