Chromium Code Reviews| 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 528f55d9f2411bedeb91f0de148115512f0dbfe7..077650aa9079fcf3ce5061f075d70d1b39dad1c2 100644 |
| --- a/chrome/test/data/webui/media_router/route_details_tests.js |
| +++ b/chrome/test/data/webui/media_router/route_details_tests.js |
| @@ -37,6 +37,16 @@ cr.define('route_details', function() { |
| assertTrue(details.$['custom-controller'].hasAttribute('hidden')); |
| }; |
| + // Checks the default route view is shown. |
| + var checkJoinButtonIsShown = function() { |
| + assertFalse(details.$['join-route-button'].hasAttribute('hidden')); |
| + }; |
| + |
| + // Checks the default route view is not shown. |
| + var checkJoinButtonIsNotShown = function() { |
| + assertTrue(details.$['join-route-button'].hasAttribute('hidden')); |
| + }; |
| + |
| // Checks the custom controller is shown. |
| var checkCustomControllerIsShown = function() { |
| assertTrue(details.$['route-information'].hasAttribute('hidden')); |
| @@ -64,9 +74,16 @@ cr.define('route_details', function() { |
| // Initialize routes and sinks. |
| fakeRouteOne = new media_router.Route('route id 1', 'sink id 1', |
| - 'Video 1', 1, true, 'chrome-extension://123/custom_view.html'); |
| + 'Video 1', 1, true, false, |
| + 'chrome-extension://123/custom_view.html'); |
| fakeRouteTwo = new media_router.Route('route id 2', 'sink id 2', |
| - 'Video 2', 2, false); |
| + 'Video 2', 2, false, true); |
| + fakeSinkOne = new media_router.Sink('sink id 1', 'Living Room', |
|
apacible
2015/12/09 19:56:25
What are fakeSinkOne and fakeSinkTwo used for?
matt.boetger
2015/12/16 00:21:08
Nothing anymore. Thanks for catching.
|
| + media_router.SinkIconType.CAST, |
| + media_router.SinkStatus.ACTIVE, [0, 1, 2]); |
| + fakeSinkTwo = new media_router.Sink('sink id 2', 'my device', |
| + media_router.SinkIconType.CAST, |
| + media_router.SinkStatus.ACTIVE, [0, 1, 2]); |
| // Allow for the route details to be created and attached. |
| setTimeout(done); |
| @@ -81,11 +98,23 @@ cr.define('route_details', function() { |
| MockInteractions.tap(details.$['close-route-button']); |
| }); |
| + // Tests for 'close-route-click' event firing when the |
| + // 'close-route-button' button is clicked. |
|
apacible
2015/12/09 19:56:25
nit: 'join-route-button'
matt.boetger
2015/12/16 00:21:08
Done.
|
| + test('join route button click', function(done) { |
| + details.addEventListener('join-route-click', function() { |
| + done(); |
| + }); |
| + MockInteractions.tap(details.$['join-route-button']); |
| + }); |
| + |
| // Tests the initial expected text. |
| test('initial text setting', function() { |
| // <paper-button> text is styled as upper case. |
| checkSpanText(loadTimeData.getString('stopCastingButton') |
| .toUpperCase(), 'close-route-button'); |
| + // unless it's hidden (join is hidden unless the route can be joined) |
|
apacible
2015/12/09 19:56:25
This is a fragment; is this a continuation from th
apacible
2015/12/09 19:56:25
nit: period at the end.
matt.boetger
2015/12/16 00:21:08
Done.
matt.boetger
2015/12/16 00:21:08
Done.
|
| + checkSpanText(loadTimeData.getString('joinButton'), |
| + 'join-route-button'); |
| checkSpanText('', 'route-information'); |
| }); |
| @@ -101,6 +130,7 @@ cr.define('route_details', function() { |
| checkSpanText(loadTimeData.getStringF('castingActivityStatus', |
| fakeRouteOne.description), 'route-information'); |
| checkDefaultViewIsShown(); |
| + checkJoinButtonIsNotShown(); |
| // Set |route| to a different route. |
| details.route = fakeRouteTwo; |
| @@ -108,6 +138,7 @@ cr.define('route_details', function() { |
| checkSpanText(loadTimeData.getStringF('castingActivityStatus', |
| fakeRouteTwo.description), 'route-information'); |
| checkDefaultViewIsShown(); |
| + checkJoinButtonIsShown(); |
| }); |
| // Tests when |route| exists, has a custom controller, and it loads. |