| Index: chrome/test/data/webui/media_router/media_router_container_filter_tests.js
|
| diff --git a/chrome/test/data/webui/media_router/media_router_container_filter_tests.js b/chrome/test/data/webui/media_router/media_router_container_filter_tests.js
|
| index 3128fb4d3fb413640367dfefcd97bcab89835fb2..63a71c2efc55bb33e1e9c89dd4f75c991d41daf5 100644
|
| --- a/chrome/test/data/webui/media_router/media_router_container_filter_tests.js
|
| +++ b/chrome/test/data/webui/media_router/media_router_container_filter_tests.js
|
| @@ -8,84 +8,10 @@ cr.define('media_router_container_filter', function() {
|
| function registerTests() {
|
| suite('MediaRouterContainerFilter', function() {
|
| /**
|
| - * The list of current routes.
|
| - * @type {!Array<!media_router.Route>}
|
| + * Media Router Container created before each test.
|
| + * @type {MediaRouterContainer}
|
| */
|
| - var fakeRouteList = [];
|
| -
|
| - /**
|
| - * The list of available sinks.
|
| - * @type {!Array<!media_router.Sink>}
|
| - */
|
| - var fakeSinkList = [];
|
| -
|
| - /**
|
| - * The list of elements to check for visibility.
|
| - * @const {!Array<string>}
|
| - */
|
| - var hiddenCheckElementIdList = [
|
| - 'cast-mode-list',
|
| - 'container-header',
|
| - 'device-missing',
|
| - 'first-run-flow',
|
| - 'first-run-flow-cloud-pref',
|
| - 'issue-banner',
|
| - 'no-search-matches',
|
| - 'route-details',
|
| - 'search-results',
|
| - 'sink-list',
|
| - 'sink-list-view',
|
| - ];
|
| -
|
| - /**
|
| - * Search text that will match all sinks.
|
| - * @type {string}
|
| - */
|
| - var searchTextAll;
|
| -
|
| - /**
|
| - * Search text that won't match any sink in fakeSinkList.
|
| - * @type {string}
|
| - */
|
| - var searchTextNone;
|
| -
|
| - /**
|
| - * Search text that will match exactly one sink.
|
| - * @type {string}
|
| - */
|
| - var searchTextOne;
|
| -
|
| - // Checks whether |view| matches the current view of |container|.
|
| - var checkCurrentView = function(view) {
|
| - assertEquals(view, container.currentView_);
|
| - };
|
| -
|
| - // Checks whether the elements specified in |elementIdList| are visible.
|
| - // Checks whether all other elements are not visible.
|
| - var checkElementsVisibleWithId = function(elementIdList) {
|
| - for (var i = 0; i < elementIdList.length; i++)
|
| - checkElementVisibleWithId(true, elementIdList[i]);
|
| -
|
| - for (var j = 0; j < hiddenCheckElementIdList.length; j++) {
|
| - if (elementIdList.indexOf(hiddenCheckElementIdList[j]) == -1)
|
| - checkElementVisibleWithId(false, hiddenCheckElementIdList[j]);
|
| - }
|
| - };
|
| -
|
| - // Checks the visibility of an element with |elementId| in |container|.
|
| - // An element is considered visible if it exists and its |hidden| property
|
| - // is |false|.
|
| - var checkElementVisibleWithId = function(visible, elementId) {
|
| - var element = container.$$('#' + elementId);
|
| - var elementVisible = !!element && !element.hidden &&
|
| - element.style.display != 'none';
|
| - assertEquals(visible, elementVisible, elementId);
|
| - };
|
| -
|
| - // Checks whether |expected| and the text in the |element| are equal.
|
| - var checkElementText = function(expected, element) {
|
| - assertEquals(expected.trim(), element.textContent.trim());
|
| - };
|
| + var container;
|
|
|
| // Import media_router_container.html before running suite.
|
| suiteSetup(function() {
|
| @@ -100,43 +26,20 @@ cr.define('media_router_container_filter', function() {
|
| container = document.createElement('media-router-container');
|
| document.body.appendChild(container);
|
|
|
| - // Initialize local variables.
|
| - container.castModeList = [
|
| - new media_router.CastMode(0x1, 'Description 0', 'google.com'),
|
| - new media_router.CastMode(0x2, 'Description 1', null),
|
| - new media_router.CastMode(0x4, 'Description 2', null),
|
| - ];
|
| + // Get common functions and variables.
|
| + var test_base = media_router_container_test_base.init(container);
|
|
|
| - fakeRouteList = [
|
| - new media_router.Route('id 1', 'sink id 1',
|
| - 'Title 1', 0, true, false),
|
| - new media_router.Route('id 2', 'sink id 2',
|
| - 'Title 2', 1, false, true),
|
| - ];
|
| + fakeRouteList = test_base.fakeRouteList;
|
| + fakeSinkList = test_base.fakeSinkList;
|
| + searchTextAll = test_base.searchTextAll;
|
| + searchTextNone = test_base.searchTextNone;
|
| + searchTextOne = test_base.searchTextOne;
|
|
|
| - fakeRouteListWithLocalRoutesOnly = [
|
| - new media_router.Route('id 1', 'sink id 1',
|
| - 'Title 1', 0, true, false),
|
| - new media_router.Route('id 2', 'sink id 2',
|
| - 'Title 2', 1, true, false),
|
| - ];
|
| -
|
| - var castModeBitset = 0x2 | 0x4 | 0x8;
|
| - fakeSinkList = [
|
| - new media_router.Sink('sink id 1', 'Sink 1', null, null,
|
| - media_router.SinkIconType.CAST,
|
| - media_router.SinkStatus.ACTIVE, castModeBitset),
|
| - new media_router.Sink('sink id 2', 'Sink 2', null, null,
|
| - media_router.SinkIconType.CAST,
|
| - media_router.SinkStatus.ACTIVE, castModeBitset),
|
| - new media_router.Sink('sink id 3', 'Sink 3', null, null,
|
| - media_router.SinkIconType.CAST,
|
| - media_router.SinkStatus.PENDING, castModeBitset),
|
| - ];
|
| + checkCurrentView = test_base.checkCurrentView;
|
| + checkElementsVisibleWithId = test_base.checkElementsVisibleWithId;
|
| + checkElementText = test_base.checkElementText;
|
|
|
| - searchTextAll = 'sink';
|
| - searchTextNone = 'abc';
|
| - searchTextOne = 'sink 1';
|
| + container.castModeList = test_base.fakeCastModeList;
|
|
|
| // Allow for the media router container to be created and attached.
|
| setTimeout(done);
|
|
|