| OLD | NEW |
| 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 Suite of tests for media-router-container that focus on | 5 /** @fileoverview Suite of tests for media-router-container that focus on |
| 6 * routes. | 6 * routes. |
| 7 */ | 7 */ |
| 8 cr.define('media_router_container_route', function() { | 8 cr.define('media_router_container_route', function() { |
| 9 function registerTests() { | 9 function registerTests() { |
| 10 suite('MediaRouterContainerRoute', function() { | 10 suite('MediaRouterContainerRoute', function() { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 container.issue = fakeBlockingIssue; | 304 container.issue = fakeBlockingIssue; |
| 305 setTimeout(function() { | 305 setTimeout(function() { |
| 306 checkElementsVisibleWithId(['container-header', | 306 checkElementsVisibleWithId(['container-header', |
| 307 'device-missing', | 307 'device-missing', |
| 308 'issue-banner']); | 308 'issue-banner']); |
| 309 done(); | 309 done(); |
| 310 }); | 310 }); |
| 311 }); | 311 }); |
| 312 | 312 |
| 313 test('creating route with selected cast mode', function(done) { | 313 test('creating route with selected cast mode', function(done) { |
| 314 container.allSinks = fakeSinkList; | |
| 315 MockInteractions.tap(container.$['container-header']. | |
| 316 $['arrow-drop-icon']); | |
| 317 setTimeout(function() { | 314 setTimeout(function() { |
| 318 // Select cast mode 2. | 315 container.allSinks = fakeSinkList; |
| 319 var castModeList = | 316 MockInteractions.tap(container.$['container-header']. |
| 320 container.$$('#cast-mode-list').querySelectorAll('paper-item'); | 317 $['arrow-drop-icon']); |
| 321 MockInteractions.tap(castModeList[1]); | |
| 322 assertEquals(fakeCastModeList[1].description, container.headerText); | |
| 323 setTimeout(function() { | 318 setTimeout(function() { |
| 324 var sinkList = | 319 // Select cast mode 2. |
| 325 container.shadowRoot.getElementById('sink-list') | 320 var castModeList = |
| 326 .querySelectorAll('paper-item'); | 321 container.$$('#cast-mode-list').querySelectorAll('paper-item'); |
| 327 container.addEventListener('create-route', function(data) { | 322 MockInteractions.tap(castModeList[1]); |
| 328 assertEquals(fakeSinkList[2].id, data.detail.sinkId); | 323 assertEquals(fakeCastModeList[1].description, container.headerText); |
| 329 // Cast mode 2 is used, since we selected it explicitly. | 324 setTimeout(function() { |
| 330 assertEquals(fakeCastModeList[1].type, | 325 var sinkList = |
| 331 data.detail.selectedCastModeValue); | 326 container.shadowRoot.getElementById('sink-list') |
| 332 done(); | 327 .querySelectorAll('paper-item'); |
| 328 container.addEventListener('create-route', function(data) { |
| 329 assertEquals(fakeSinkList[2].id, data.detail.sinkId); |
| 330 // Cast mode 2 is used, since we selected it explicitly. |
| 331 assertEquals(fakeCastModeList[1].type, |
| 332 data.detail.selectedCastModeValue); |
| 333 done(); |
| 334 }); |
| 335 // All sinks are compatible with cast mode 2. |
| 336 assertEquals(fakeSinkList.length, sinkList.length); |
| 337 // Tap on a sink without a route, which should fire a |
| 338 // 'create-route' event. |
| 339 MockInteractions.tap(sinkList[2]); |
| 333 }); | 340 }); |
| 334 // All sinks are compatible with cast mode 2. | |
| 335 assertEquals(fakeSinkList.length, sinkList.length); | |
| 336 // Tap on a sink without a route, which should fire a 'create-route' | |
| 337 // event. | |
| 338 MockInteractions.tap(sinkList[2]); | |
| 339 }); | 341 }); |
| 340 }); | 342 }); |
| 341 }); | 343 }); |
| 342 }); | 344 }); |
| 343 } | 345 } |
| 344 | 346 |
| 345 return { | 347 return { |
| 346 registerTests: registerTests, | 348 registerTests: registerTests, |
| 347 }; | 349 }; |
| 348 }); | 350 }); |
| OLD | NEW |