OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 Suite of tests for route-details. */ | 5 /** @fileoverview Suite of tests for route-details. */ |
6 cr.define('route_details', function() { | 6 cr.define('route_details', function() { |
7 function registerTests() { | 7 function registerTests() { |
8 suite('RouteDetails', function() { | 8 suite('RouteDetails', function() { |
9 /** | 9 /** |
10 * Route Details created before each test. | 10 * Route Details created before each test. |
11 * @type {RouteDetails} | 11 * @type {RouteDetails} |
12 */ | 12 */ |
13 var details; | 13 var details; |
14 | 14 |
15 /** | 15 /** |
16 * First fake route created before each test. | 16 * First fake route created before each test. |
17 * @type {media_router.Route} | 17 * @type {media_router.Route} |
18 */ | 18 */ |
19 var fakeRouteOne; | 19 var fakeRouteOne; |
20 | 20 |
21 /** | 21 /** |
22 * Second fake route created before each test. | 22 * Second fake route created before each test. |
23 * @type {media_router.Route} | 23 * @type {media_router.Route} |
24 */ | 24 */ |
25 var fakeRouteTwo; | 25 var fakeRouteTwo; |
26 | 26 |
| 27 /** |
| 28 * Fake sink that corresponds to |fakeRouteOne|. |
| 29 * @type {media_router.Sink} |
| 30 */ |
| 31 var fakeSinkOne; |
| 32 |
27 // Checks whether |expected| and the text in the span element in | 33 // Checks whether |expected| and the text in the span element in |
28 // the |elementId| element are equal. | 34 // the |elementId| element are equal. |
29 var checkSpanText = function(expected, elementId) { | 35 var checkSpanText = function(expected, elementId) { |
30 assertEquals(expected, | 36 assertEquals(expected, |
31 details.$[elementId].querySelector('span').innerText); | 37 details.$[elementId].querySelector('span').innerText); |
32 }; | 38 }; |
33 | 39 |
34 // Checks the default route view is shown. | 40 // Checks the default route view is shown. |
35 var checkDefaultViewIsShown = function() { | 41 var checkDefaultViewIsShown = function() { |
36 assertFalse(details.$['route-information'].hasAttribute('hidden')); | 42 assertFalse(details.$['route-information'].hasAttribute('hidden')); |
37 assertTrue(details.$['custom-controller'].hasAttribute('hidden')); | 43 assertTrue(details.$['custom-controller'].hasAttribute('hidden')); |
38 }; | 44 }; |
39 | 45 |
40 // Checks the default route view is shown. | 46 // Checks the start button is shown. |
41 var checkStartCastButtonIsShown = function() { | 47 var checkStartCastButtonIsShown = function() { |
42 assertFalse( | 48 assertFalse( |
43 details.$['start-casting-to-route-button'].hasAttribute('hidden')); | 49 details.$['start-casting-to-route-button'].hasAttribute('hidden')); |
44 }; | 50 }; |
45 | 51 |
46 // Checks the default route view is not shown. | 52 // Checks the start button is not shown. |
47 var checkStartCastButtonIsNotShown = function() { | 53 var checkStartCastButtonIsNotShown = function() { |
48 assertTrue( | 54 assertTrue( |
49 details.$['start-casting-to-route-button'].hasAttribute('hidden')); | 55 details.$['start-casting-to-route-button'].hasAttribute('hidden')); |
50 }; | 56 }; |
51 | 57 |
52 // Checks the custom controller is shown. | 58 // Checks the custom controller is shown. |
53 var checkCustomControllerIsShown = function() { | 59 var checkCustomControllerIsShown = function() { |
54 assertTrue(details.$['route-information'].hasAttribute('hidden')); | 60 assertTrue(details.$['route-information'].hasAttribute('hidden')); |
55 assertFalse(details.$['custom-controller'].hasAttribute('hidden')); | 61 assertFalse(details.$['custom-controller'].hasAttribute('hidden')); |
56 }; | 62 }; |
57 | 63 |
58 // Checks whether |expected| and the text in the |elementId| element | 64 // Checks whether |expected| and the text in the |elementId| element |
59 // are equal given an id. | 65 // are equal given an id. |
60 var checkElementTextWithId = function(expected, elementId) { | 66 var checkElementTextWithId = function(expected, elementId) { |
61 assertEquals(expected, details.$[elementId].innerText); | 67 assertEquals(expected, details.$[elementId].innerText); |
62 }; | 68 }; |
63 | 69 |
64 /** | |
65 * Fake sink that corresponds to |fakeRouteOne|. | |
66 * @type {media_router.Sink} | |
67 */ | |
68 var fakeSinkOne; | |
69 | |
70 // Import route_details.html before running suite. | 70 // Import route_details.html before running suite. |
71 suiteSetup(function() { | 71 suiteSetup(function() { |
72 return PolymerTest.importHtml( | 72 return PolymerTest.importHtml( |
73 'chrome://media-router/elements/route_details/' + | 73 'chrome://media-router/elements/route_details/' + |
74 'route_details.html'); | 74 'route_details.html'); |
75 }); | 75 }); |
76 | 76 |
77 // Initialize a route-details before each test. | 77 // Initialize a route-details before each test. |
78 setup(function(done) { | 78 setup(function(done) { |
79 PolymerTest.clearBody(); | 79 PolymerTest.clearBody(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 done(); | 229 done(); |
230 }); | 230 }); |
231 }); | 231 }); |
232 }); | 232 }); |
233 } | 233 } |
234 | 234 |
235 return { | 235 return { |
236 registerTests: registerTests, | 236 registerTests: registerTests, |
237 }; | 237 }; |
238 }); | 238 }); |
OLD | NEW |