Chromium Code Reviews| Index: chrome/test/data/webui/media_router/media_router_container_part1_tests.js |
| diff --git a/chrome/test/data/webui/media_router/media_router_container_tests.js b/chrome/test/data/webui/media_router/media_router_container_part1_tests.js |
| similarity index 67% |
| rename from chrome/test/data/webui/media_router/media_router_container_tests.js |
| rename to chrome/test/data/webui/media_router/media_router_container_part1_tests.js |
| index 446b098fc9ca3a34ff0a2ec8291b4ab1f2b0f71f..958806591717c35abdfb5503f44b6d459fa59ac3 100644 |
| --- a/chrome/test/data/webui/media_router/media_router_container_tests.js |
| +++ b/chrome/test/data/webui/media_router/media_router_container_part1_tests.js |
| @@ -3,9 +3,9 @@ |
| // found in the LICENSE file. |
| /** @fileoverview Suite of tests for media-router-container. */ |
|
apacible
2016/03/04 01:25:28
How did you decide how to split up tests? Is this
btolsch
2016/03/04 02:14:37
Unfortunately I can't reproduce the timeouts. So t
apacible
2016/03/04 17:21:33
How long does it take to currently execute for eac
btolsch
2016/03/04 20:00:37
It takes about 2-2.2 seconds to run each part on m
|
| -cr.define('media_router_container', function() { |
| +cr.define('media_router_container_part1', function() { |
|
apacible
2016/03/04 01:25:28
nit: spell out the numbers.
btolsch
2016/03/04 02:14:37
Done.
|
| function registerTests() { |
| - suite('MediaRouterContainer', function() { |
| + suite('MediaRouterContainerPart1', function() { |
| /** |
| * Media Router Container created before each test. |
| * @type {MediaRouterContainer} |
| @@ -98,11 +98,6 @@ cr.define('media_router_container', function() { |
| assertEquals(expected.trim(), element.textContent.trim()); |
| }; |
| - // Checks whether |expected| and the |property| in |container| are equal. |
| - var checkPropertyValue = function(expected, property) { |
| - assertEquals(expected.trim(), container.property); |
| - } |
| - |
| // Import media_router_container.html before running suite. |
| suiteSetup(function() { |
| return PolymerTest.importHtml( |
| @@ -156,10 +151,6 @@ cr.define('media_router_container', function() { |
| media_router.SinkStatus.PENDING, castModeBitset), |
| ]; |
| - searchTextAll = 'sink'; |
| - searchTextNone = 'abc'; |
| - searchTextOne = 'sink 1'; |
| - |
| fakeBlockingIssue = new media_router.Issue( |
| 'issue id 1', 'Issue Title 1', 'Issue Message 1', 0, 1, |
| 'route id 1', true, 1234); |
| @@ -223,6 +214,8 @@ cr.define('media_router_container', function() { |
| assertFalse(data.detail.optedIntoCloudServices); |
| done(); |
| }); |
| + // Tapping the checkbox doesn't work if the browser window that the |
| + // test opens is unfocused, causing this test to fail. |
|
imcheng
2016/03/04 00:26:58
If there is there a tracking bug for this, please
apacible
2016/03/04 01:25:28
In what case does the browser window become unfocu
btolsch
2016/03/04 02:14:37
If I manually switch back to the console to watch
btolsch
2016/03/04 02:14:37
Done.
apacible
2016/03/04 17:21:33
Ah. This is expected behavior. :)
Browser tests a
btolsch
2016/03/04 20:00:37
Done.
|
| MockInteractions.tap(container.shadowRoot.getElementById( |
| 'first-run-cloud-checkbox')); |
| MockInteractions.tap(container.shadowRoot.getElementById( |
| @@ -309,74 +302,6 @@ cr.define('media_router_container', function() { |
| checkCurrentView(media_router.MediaRouterView.SINK_LIST); |
| }); |
| - // Tests the header text. Choosing a cast mode updates the header text. |
| - test('header text with no default cast modes', function(done) { |
| - assertEquals(loadTimeData.getString('selectCastModeHeader'), |
| - container.selectCastModeHeaderText_); |
| - |
| - // The container is currently in auto cast mode, since we have not |
| - // picked a cast mode explicitly, and the sinks is not compatible |
| - // with exactly one cast mode. |
| - assertEquals(media_router.AUTO_CAST_MODE.description, |
| - container.headerText); |
| - assertFalse(container.userHasSelectedCastMode_); |
| - |
| - container.castModeList = fakeCastModeListWithNonDefaultModesOnly; |
| - |
| - // Switch to cast mode list view. |
| - MockInteractions.tap(container.$['container-header']. |
| - $['arrow-drop-icon']); |
| - setTimeout(function() { |
| - var castModeList = |
| - container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| - assertEquals(fakeCastModeListWithNonDefaultModesOnly.length, |
| - castModeList.length); |
| - for (var i = 0; i < castModeList.length; i++) { |
| - MockInteractions.tap(castModeList[i]); |
| - assertEquals( |
| - fakeCastModeListWithNonDefaultModesOnly[i].description, |
| - container.headerText); |
| - checkElementText( |
| - fakeCastModeListWithNonDefaultModesOnly[i].description, |
| - castModeList[i]); |
| - } |
| - |
| - done(); |
| - }); |
| - }); |
| - |
| - // Tests the header text when updated with a cast mode list with a mix of |
| - // default and non-default cast modes. |
| - test('cast modes with one default mode', function(done) { |
| - container.castModeList = fakeCastModeList; |
| - |
| - // Switch to cast mode list view. |
| - MockInteractions.tap(container.$['container-header']. |
| - $['arrow-drop-icon']); |
| - setTimeout(function() { |
| - var castModeList = |
| - container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| - |
| - for (var i = 0; i < fakeCastModeList.length; i++) { |
| - MockInteractions.tap(castModeList[i]); |
| - if (fakeCastModeList[i].type == |
| - media_router.CastModeType.DEFAULT) { |
| - assertEquals(fakeCastModeList[i].description, |
| - container.headerText); |
| - |
| - checkElementText(fakeCastModeList[i].host, castModeList[i]); |
| - } else { |
| - assertEquals(fakeCastModeList[i].description, |
| - container.headerText); |
| - checkElementText(fakeCastModeList[i].description, |
| - castModeList[i]); |
| - } |
| - } |
| - |
| - done(); |
| - }); |
| - }); |
| - |
| // Tests that text shown for each sink matches their names. |
| test('sink list text', function(done) { |
| container.allSinks = fakeSinkList; |
| @@ -544,33 +469,6 @@ cr.define('media_router_container', function() { |
| checkCurrentView(media_router.MediaRouterView.SINK_LIST); |
| }); |
| - // Tests for expected visible UI when the view is CAST_MODE_LIST. |
| - test('cast mode list state visibility', function(done) { |
| - container.showCastModeList_(); |
| - setTimeout(function() { |
| - checkElementsVisibleWithId(['cast-mode-list', |
| - 'container-header', |
| - 'device-missing']); |
| - |
| - // Set a non-blocking issue. The issue should stay hidden. |
| - container.issue = fakeNonBlockingIssue; |
| - setTimeout(function() { |
| - checkElementsVisibleWithId(['cast-mode-list', |
| - 'container-header', |
| - 'device-missing']); |
| - |
| - // Set a blocking issue. The issue should stay hidden. |
| - container.issue = fakeBlockingIssue; |
| - setTimeout(function() { |
| - checkElementsVisibleWithId(['container-header', |
| - 'device-missing', |
| - 'issue-banner']); |
| - done(); |
| - }); |
| - }); |
| - }); |
| - }); |
| - |
| // Tests for the expected visible UI when interacting with the first run |
| // flow. |
| test('first run button visibility', function(done) { |
| @@ -588,30 +486,6 @@ cr.define('media_router_container', function() { |
| }); |
| }); |
| - // Tests for the expected visible UI when interacting with the first run |
| - // flow with cloud services preference. |
| - test('first run button visibility', function(done) { |
| - container.showFirstRunFlow = true; |
| - container.showFirstRunFlowCloudPref = true; |
| - |
| - setTimeout(function() { |
| - checkElementsVisibleWithId(['container-header', |
| - 'device-missing', |
| - 'first-run-flow', |
| - 'first-run-flow-cloud-pref', |
| - 'sink-list-view']); |
| - MockInteractions.tap(container.shadowRoot.getElementById( |
| - 'first-run-button')); |
| - |
| - setTimeout(function() { |
| - checkElementsVisibleWithId(['container-header', |
| - 'device-missing', |
| - 'sink-list-view']); |
| - done(); |
| - }); |
| - }); |
| - }); |
| - |
| // Tests for expected visible UI when the view is ROUTE_DETAILS. |
| test('route details visibility', function(done) { |
| container.showRouteDetails_(); |
| @@ -797,82 +671,6 @@ cr.define('media_router_container', function() { |
| }); |
| }); |
| - // Tests that the sink list does not contain any sinks that are not |
| - // compatible with the selected cast mode and are not associated with a |
| - // route. |
| - test('sink list in user selected cast mode', function(done) { |
| - var newSinks = [ |
| - new media_router.Sink('sink id 10', 'Sink 10', null, null, |
| - media_router.SinkIconType.CAST, |
| - media_router.SinkStatus.ACTIVE, 0x4 | 0x8), |
| - new media_router.Sink('sink id 20', 'Sink 20', null, null, |
| - media_router.SinkIconType.CAST, |
| - media_router.SinkStatus.ACTIVE, 0x2 | 0x4 | 0x8), |
| - new media_router.Sink('sink id 30', 'Sink 30', null, null, |
| - media_router.SinkIconType.CAST, |
| - media_router.SinkStatus.PENDING, 0x4 | 0x8), |
| - ]; |
| - |
| - container.allSinks = newSinks; |
| - container.routeList = [ |
| - new media_router.Route('id 1', 'sink id 30', |
| - 'Title 1', 1, false, false), |
| - ]; |
| - |
| - setTimeout(function() { |
| - var sinkList = |
| - container.$['sink-list'].querySelectorAll('paper-item'); |
| - |
| - // Since we haven't selected a cast mode, we don't filter sinks. |
| - assertEquals(3, sinkList.length); |
| - |
| - MockInteractions.tap(container.$['container-header']. |
| - $['arrow-drop-icon']); |
| - setTimeout(function() { |
| - // Cast mode 1 is selected, and the sink list is filtered. |
| - var castModeList = |
| - container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| - MockInteractions.tap(castModeList[1]); |
| - assertEquals(fakeCastModeList[1].description, container.headerText); |
| - assertEquals(fakeCastModeList[1].type, |
| - container.shownCastModeValue_); |
| - |
| - setTimeout(function() { |
| - var sinkList = |
| - container.$['sink-list'].querySelectorAll('paper-item'); |
| - |
| - // newSinks[0] got filtered out since it is not compatible with |
| - // cast mode 1. |
| - // 'Sink 20' should be on the list because it contains the |
| - // selected cast mode. (sinkList[0] = newSinks[1]) |
| - // 'Sink 30' should be on the list because it has a route. |
| - // (sinkList[1] = newSinks[2]) |
| - assertEquals(2, sinkList.length); |
| - checkElementText(newSinks[1].name, sinkList[0]); |
| - |
| - // |sinkList[1]| contains route title in addition to sink name. |
| - assertTrue(sinkList[1].textContent.trim().startsWith( |
| - newSinks[2].name.trim())); |
| - |
| - // Cast mode is not switched back even if there are no sinks |
| - // compatible with selected cast mode, because we explicitly |
| - // selected that cast mode. |
| - container.allSinks = []; |
| - setTimeout(function() { |
| - assertEquals(fakeCastModeList[1].description, |
| - container.headerText); |
| - assertEquals(fakeCastModeList[1].type, |
| - container.shownCastModeValue_); |
| - var sinkList = |
| - container.$['sink-list'].querySelectorAll('paper-item'); |
| - assertEquals(0, sinkList.length); |
| - done(); |
| - }); |
| - }); |
| - }); |
| - }); |
| - }); |
| - |
| // Container remains in auto mode even if the cast mode list changed. |
| test('cast mode list updated in auto mode', function(done) { |
| assertEquals(media_router.AUTO_CAST_MODE.description, |
| @@ -891,102 +689,6 @@ cr.define('media_router_container', function() { |
| done(); |
| }); |
| }); |
| - |
| - // If the container is not in auto mode, and the mode it is currently in |
| - // no longer exists in the list of cast modes, then switch back to auto |
| - // mode. |
| - test('cast mode list updated in selected cast mode', function(done) { |
| - assertEquals(media_router.AUTO_CAST_MODE.description, |
| - container.headerText); |
| - assertEquals(media_router.CastModeType.AUTO, |
| - container.shownCastModeValue_); |
| - assertFalse(container.userHasSelectedCastMode_); |
| - |
| - MockInteractions.tap(container.$['container-header']. |
| - $['arrow-drop-icon']); |
| - setTimeout(function() { |
| - var castModeList = |
| - container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| - MockInteractions.tap(castModeList[0]); |
| - setTimeout(function() { |
| - assertEquals(fakeCastModeList[0].description, container.headerText); |
| - assertEquals(fakeCastModeList[0].type, |
| - container.shownCastModeValue_); |
| - assertTrue(container.userHasSelectedCastMode_); |
| - container.castModeList = fakeCastModeList.slice(1); |
| - setTimeout(function() { |
| - assertEquals(media_router.AUTO_CAST_MODE.description, |
| - container.headerText); |
| - assertEquals(media_router.CastModeType.AUTO, |
| - container.shownCastModeValue_); |
| - assertFalse(container.userHasSelectedCastMode_); |
| - done(); |
| - }); |
| - }); |
| - }); |
| - }); |
| - |
| - test('creating route with selected cast mode', function(done) { |
| - container.allSinks = fakeSinkList; |
| - MockInteractions.tap(container.$['container-header']. |
| - $['arrow-drop-icon']); |
| - setTimeout(function() { |
| - // Select cast mode 2. |
| - var castModeList = |
| - container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| - MockInteractions.tap(castModeList[1]); |
| - assertEquals(fakeCastModeList[1].description, container.headerText); |
| - setTimeout(function() { |
| - var sinkList = |
| - container.$['sink-list'].querySelectorAll('paper-item'); |
| - container.addEventListener('create-route', function(data) { |
| - assertEquals(fakeSinkList[2].id, data.detail.sinkId); |
| - // Cast mode 2 is used, since we selected it explicitly. |
| - assertEquals(fakeCastModeList[1].type, |
| - data.detail.selectedCastModeValue); |
| - done(); |
| - }); |
| - // All sinks are compatible with cast mode 2. |
| - assertEquals(fakeSinkList.length, sinkList.length); |
| - // Tap on a sink without a route, which should fire a 'create-route' |
| - // event. |
| - MockInteractions.tap(sinkList[2]); |
| - }); |
| - }); |
| - }); |
| - |
| - // Tests that after a different cast mode is selected, the sink list will |
| - // change based on the sinks compatibility with the new cast mode. |
| - test('changing cast mode changes sink list', function(done) { |
| - container.allSinks = fakeSinkList; |
| - |
| - MockInteractions.tap(container.$['container-header']. |
| - $['arrow-drop-icon']); |
| - setTimeout(function() { |
| - var castModeList = |
| - container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| - MockInteractions.tap(castModeList[0]); |
| - assertEquals(fakeCastModeList[0].description, container.headerText); |
| - |
| - setTimeout(function() { |
| - var sinkList = |
| - container.$['sink-list'].querySelectorAll('paper-item'); |
| - |
| - // The sink list is empty because none of the sinks in fakeSinkList |
| - // is compatible with cast mode 0. |
| - assertEquals(0, sinkList.length); |
| - MockInteractions.tap(castModeList[2]); |
| - assertEquals(fakeCastModeList[2].description, container.headerText); |
| - |
| - setTimeout(function() { |
| - var sinkList = |
| - container.$['sink-list'].querySelectorAll('paper-item'); |
| - assertEquals(3, sinkList.length); |
| - done(); |
| - }); |
| - }); |
| - }); |
| - }); |
| }); |
| } |