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

Side by Side Diff: chrome/test/data/webui/media_router/media_router_container_test_base.js

Issue 2040883002: [Media Router] Assign each route a current cast mode if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for WebUI::CallJavascriptFunction rename Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** @fileoverview Provides basic utility functions and variables for 5 /** @fileoverview Provides basic utility functions and variables for
6 * media-router-container tests. 6 * media-router-container tests.
7 */ 7 */
8 8
9 cr.define('media_router_container_test_base', function() { 9 cr.define('media_router_container_test_base', function() {
10 function init(container) { 10 function init(container) {
(...skipping 18 matching lines...) Expand all
29 for (var i = 0; i < elementIdList.length; i++) 29 for (var i = 0; i < elementIdList.length; i++)
30 checkElementVisibleWithId(true, elementIdList[i]); 30 checkElementVisibleWithId(true, elementIdList[i]);
31 31
32 for (var j = 0; j < hiddenCheckElementIdList.length; j++) { 32 for (var j = 0; j < hiddenCheckElementIdList.length; j++) {
33 if (elementIdList.indexOf(hiddenCheckElementIdList[j]) == -1) 33 if (elementIdList.indexOf(hiddenCheckElementIdList[j]) == -1)
34 checkElementVisibleWithId(false, hiddenCheckElementIdList[j]); 34 checkElementVisibleWithId(false, hiddenCheckElementIdList[j]);
35 } 35 }
36 }; 36 };
37 37
38 /** 38 /**
39 * Checks the visibility of an element. An element is considered visible if
40 * it exists and its |hidden| property is |false|.
41 *
42 * @param {boolean} visible Whether the element should be visible.
43 * @param {?Element} element The element to test.
44 * @param {?string} elementId Optional element id to display.
45 */
46 var checkElementVisible = function(visible, element, elementId) {
47 var elementVisible = !!element && !element.hidden &&
48 element.style.display != 'none';
49 assertEquals(visible, elementVisible, elementId);
50 };
51
52 /**
39 * Checks the visibility of an element with |elementId| in |container|. 53 * Checks the visibility of an element with |elementId| in |container|.
40 * An element is considered visible if it exists and its |hidden| property 54 * An element is considered visible if it exists and its |hidden| property
41 * is |false|. 55 * is |false|.
42 * 56 *
43 * @param {boolean} visible Whether the element should be visible. 57 * @param {boolean} visible Whether the element should be visible.
44 * @param {!string} elementId The id of the element to test. 58 * @param {!string} elementId The id of the element to test.
45 */ 59 */
46 var checkElementVisibleWithId = function(visible, elementId) { 60 var checkElementVisibleWithId = function(visible, elementId) {
47 var element = container.$$('#' + elementId); 61 var element = container.$$('#' + elementId);
48 var elementVisible = !!element && !element.hidden && 62 checkElementVisible(visible, element);
49 element.style.display != 'none';
50 assertEquals(visible, elementVisible, elementId);
51 }; 63 };
52 64
53 /** 65 /**
54 * Checks whether |expected| and the text in the |element| are equal. 66 * Checks whether |expected| and the text in the |element| are equal.
55 * 67 *
56 * @param {!string} expected Expected text. 68 * @param {!string} expected Expected text.
57 * @param {!Element} element Element whose text will be checked. 69 * @param {!Element} element Element whose text will be checked.
58 */ 70 */
59 var checkElementText = function(expected, element) { 71 var checkElementText = function(expected, element) {
60 assertEquals(expected.trim(), element.textContent.trim()); 72 assertEquals(expected.trim(), element.textContent.trim());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 176
165 /** 177 /**
166 * Search text that will match exactly one sink. 178 * Search text that will match exactly one sink.
167 * @type {!string} 179 * @type {!string}
168 */ 180 */
169 var searchTextOne = 'sink 1'; 181 var searchTextOne = 'sink 1';
170 182
171 return { 183 return {
172 checkCurrentView: checkCurrentView, 184 checkCurrentView: checkCurrentView,
173 checkElementsVisibleWithId: checkElementsVisibleWithId, 185 checkElementsVisibleWithId: checkElementsVisibleWithId,
186 checkElementVisible: checkElementVisible,
174 checkElementVisibleWithId: checkElementVisibleWithId, 187 checkElementVisibleWithId: checkElementVisibleWithId,
175 checkElementText: checkElementText, 188 checkElementText: checkElementText,
176 fakeBlockingIssue: fakeBlockingIssue, 189 fakeBlockingIssue: fakeBlockingIssue,
177 fakeCastModeList: fakeCastModeList, 190 fakeCastModeList: fakeCastModeList,
178 fakeCastModeListWithNonDefaultModesOnly: 191 fakeCastModeListWithNonDefaultModesOnly:
179 fakeCastModeListWithNonDefaultModesOnly, 192 fakeCastModeListWithNonDefaultModesOnly,
180 fakeNonBlockingIssue: fakeNonBlockingIssue, 193 fakeNonBlockingIssue: fakeNonBlockingIssue,
181 fakeRouteList: fakeRouteList, 194 fakeRouteList: fakeRouteList,
182 fakeRouteListWithLocalRoutesOnly: fakeRouteListWithLocalRoutesOnly, 195 fakeRouteListWithLocalRoutesOnly: fakeRouteListWithLocalRoutesOnly,
183 fakeSinkList: fakeSinkList, 196 fakeSinkList: fakeSinkList,
184 searchTextAll: searchTextAll, 197 searchTextAll: searchTextAll,
185 searchTextNone: searchTextNone, 198 searchTextNone: searchTextNone,
186 searchTextOne: searchTextOne, 199 searchTextOne: searchTextOne,
187 }; 200 };
188 } 201 }
189 return {init: init}; 202 return {init: init};
190 }); 203 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698