| 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 dcab054364afd556eb40b7317709307441ca9cc8..3c285d66f7be8839193dfd3953ad515e63bd8057 100644
|
| --- a/chrome/test/data/webui/media_router/route_details_tests.js
|
| +++ b/chrome/test/data/webui/media_router/route_details_tests.js
|
| @@ -24,6 +24,12 @@ cr.define('route_details', function() {
|
| */
|
| var fakeRouteTwo;
|
|
|
| + /**
|
| + * Fake sink that corresponds to |fakeRouteOne|.
|
| + * @type {media_router.Sink}
|
| + */
|
| + var fakeSinkOne;
|
| +
|
| // Checks whether |expected| and the text in the span element in
|
| // the |elementId| element are equal.
|
| var checkSpanText = function(expected, elementId) {
|
| @@ -34,16 +40,17 @@ cr.define('route_details', function() {
|
| // Checks the default route view is shown.
|
| var checkDefaultViewIsShown = function() {
|
| assertFalse(details.$['route-information'].hasAttribute('hidden'));
|
| - assertTrue(details.$['custom-controller'].hasAttribute('hidden'));
|
| + assertTrue(
|
| + details.$$('extension-view-wrapper').hasAttribute('hidden'));
|
| };
|
|
|
| - // Checks the default route view is shown.
|
| + // Checks the start button is shown.
|
| var checkStartCastButtonIsShown = function() {
|
| assertFalse(
|
| details.$['start-casting-to-route-button'].hasAttribute('hidden'));
|
| };
|
|
|
| - // Checks the default route view is not shown.
|
| + // Checks the start button is not shown.
|
| var checkStartCastButtonIsNotShown = function() {
|
| assertTrue(
|
| details.$['start-casting-to-route-button'].hasAttribute('hidden'));
|
| @@ -52,7 +59,8 @@ cr.define('route_details', function() {
|
| // Checks the custom controller is shown.
|
| var checkCustomControllerIsShown = function() {
|
| assertTrue(details.$['route-information'].hasAttribute('hidden'));
|
| - assertFalse(details.$['custom-controller'].hasAttribute('hidden'));
|
| + assertFalse(
|
| + details.$$('extension-view-wrapper').hasAttribute('hidden'));
|
| };
|
|
|
| // Checks whether |expected| and the text in the |elementId| element
|
| @@ -61,12 +69,6 @@ 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(
|
| @@ -78,6 +80,7 @@ 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.
|
| @@ -199,35 +202,31 @@ 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) {
|
| - var loadInvoked = false;
|
| - details.$['custom-controller'].load = function(url) {
|
| - loadInvoked = true;
|
| - assertEquals('chrome-extension://123/custom_view.html', url);
|
| - return Promise.resolve();
|
| - };
|
| + details.$$('extension-view-wrapper').$['custom-controller'].load =
|
| + function(url) {
|
| + setTimeout(function() {
|
| + assertEquals('chrome-extension://123/custom_view.html', url);
|
| + checkCustomControllerIsShown();
|
| + done();
|
| + });
|
| + return Promise.resolve();
|
| + };
|
|
|
| details.route = fakeRouteOne;
|
| - setTimeout(function() {
|
| - assertTrue(loadInvoked);
|
| - checkCustomControllerIsShown();
|
| - done();
|
| - });
|
| });
|
|
|
| // Tests when |route| exists, has a custom controller, but fails to load.
|
| test('route has custom controller but loading fails', function(done) {
|
| - var loadInvoked = false;
|
| - details.$['custom-controller'].load = function(url) {
|
| - loadInvoked = true;
|
| - return Promise.reject();
|
| - };
|
| + details.$$('extension-view-wrapper').$['custom-controller'].load =
|
| + function(url) {
|
| + setTimeout(function() {
|
| + checkDefaultViewIsShown();
|
| + done();
|
| + });
|
| + return Promise.reject();
|
| + };
|
|
|
| details.route = fakeRouteOne;
|
| - setTimeout(function() {
|
| - assertTrue(loadInvoked);
|
| - checkDefaultViewIsShown();
|
| - done();
|
| - });
|
| });
|
| });
|
| }
|
|
|