| 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 media-router-container. */ | 5 /** @fileoverview Suite of tests for media-router-container. */ |
| 6 cr.define('media_router_container', function() { | 6 cr.define('media_router_container', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('MediaRouterContainer', function() { | 8 suite('MediaRouterContainer', function() { |
| 9 /** | 9 /** |
| 10 * Media Router Container created before each test. | 10 * Media Router Container created before each test. |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 // Set a non-blocking issue. The issue should stay hidden. | 397 // Set a non-blocking issue. The issue should stay hidden. |
| 398 container.issue = fakeNonBlockingIssue; | 398 container.issue = fakeNonBlockingIssue; |
| 399 checkElementsVisibleWithId(['cast-mode-list', | 399 checkElementsVisibleWithId(['cast-mode-list', |
| 400 'container-header', | 400 'container-header', |
| 401 'device-missing', | 401 'device-missing', |
| 402 'sink-list']); | 402 'sink-list']); |
| 403 | 403 |
| 404 // Set a blocking issue. The issue should stay hidden. | 404 // Set a blocking issue. The issue should stay hidden. |
| 405 container.issue = fakeBlockingIssue; | 405 container.issue = fakeBlockingIssue; |
| 406 checkElementsVisibleWithId(['cast-mode-list', | 406 checkElementsVisibleWithId(['container-header', |
| 407 'container-header', | |
| 408 'device-missing', | 407 'device-missing', |
| 409 'sink-list']); | 408 'sink-list']); |
| 410 }); | 409 }); |
| 411 | 410 |
| 412 | 411 |
| 413 // Tests for expected visible UI when the view is ROUTE_DETAILS. | 412 // Tests for expected visible UI when the view is ROUTE_DETAILS. |
| 414 test('route details visibility', function() { | 413 test('route details visibility', function() { |
| 415 container.showRouteDetails_(); | 414 container.showRouteDetails_(); |
| 416 checkElementsVisibleWithId(['device-missing', | 415 checkElementsVisibleWithId(['container-header', |
| 416 'device-missing', |
| 417 'route-details', | 417 'route-details', |
| 418 'sink-list']); | 418 'sink-list']); |
| 419 }); | 419 }); |
| 420 | 420 |
| 421 // Tests for expected visible UI when the view is ROUTE_DETAILS, and there | 421 // Tests for expected visible UI when the view is ROUTE_DETAILS, and there |
| 422 // is a non-blocking issue. | 422 // is a non-blocking issue. |
| 423 test('route details visibility non blocking issue', function(done) { | 423 test('route details visibility non blocking issue', function(done) { |
| 424 container.showRouteDetails_(); | 424 container.showRouteDetails_(); |
| 425 | 425 |
| 426 // Set a non-blocking issue. The issue should be shown. | 426 // Set a non-blocking issue. The issue should be shown. |
| 427 container.issue = fakeNonBlockingIssue; | 427 container.issue = fakeNonBlockingIssue; |
| 428 setTimeout(function() { | 428 setTimeout(function() { |
| 429 checkElementsVisibleWithId(['device-missing', | 429 checkElementsVisibleWithId(['container-header', |
| 430 'device-missing', |
| 430 'issue-banner', | 431 'issue-banner', |
| 431 'route-details', | 432 'route-details', |
| 432 'sink-list']); | 433 'sink-list']); |
| 433 done(); | 434 done(); |
| 434 }); | 435 }); |
| 435 }); | 436 }); |
| 436 | 437 |
| 437 // Tests for expected visible UI when the view is ROUTE_DETAILS, and there | 438 // Tests for expected visible UI when the view is ROUTE_DETAILS, and there |
| 438 // is a blocking issue. | 439 // is a blocking issue. |
| 439 test('route details visibility with blocking issue', function(done) { | 440 test('route details visibility with blocking issue', function(done) { |
| 440 container.showRouteDetails_(); | 441 container.showRouteDetails_(); |
| 441 | 442 |
| 442 // Set a blocking issue. The issue should be shown, and everything | 443 // Set a blocking issue. The issue should be shown, and everything |
| 443 // else, hidden. | 444 // else, hidden. |
| 444 container.issue = fakeBlockingIssue; | 445 container.issue = fakeBlockingIssue; |
| 445 setTimeout(function() { | 446 setTimeout(function() { |
| 446 checkElementsVisibleWithId(['device-missing', | 447 checkElementsVisibleWithId(['container-header', |
| 448 'device-missing', |
| 447 'issue-banner', | 449 'issue-banner', |
| 448 'sink-list']); | 450 'sink-list']); |
| 449 done(); | 451 done(); |
| 450 }); | 452 }); |
| 451 }); | 453 }); |
| 452 | 454 |
| 453 // Tests for expected visible UI when the view is SINK_LIST. | 455 // Tests for expected visible UI when the view is SINK_LIST. |
| 454 test('sink list state visibility', function() { | 456 test('sink list state visibility', function() { |
| 455 container.showSinkList_(); | 457 container.showSinkList_(); |
| 456 checkElementsVisibleWithId(['container-header', | 458 checkElementsVisibleWithId(['container-header', |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 test('sink list visibility blocking issue', function(done) { | 491 test('sink list visibility blocking issue', function(done) { |
| 490 container.showSinkList_(); | 492 container.showSinkList_(); |
| 491 | 493 |
| 492 // Set an non-empty sink list. | 494 // Set an non-empty sink list. |
| 493 container.allSinks = fakeSinkList; | 495 container.allSinks = fakeSinkList; |
| 494 | 496 |
| 495 // Set a blocking issue. The issue should be shown, and everything | 497 // Set a blocking issue. The issue should be shown, and everything |
| 496 // else, hidden. | 498 // else, hidden. |
| 497 container.issue = fakeBlockingIssue; | 499 container.issue = fakeBlockingIssue; |
| 498 setTimeout(function() { | 500 setTimeout(function() { |
| 499 checkElementsVisibleWithId(['issue-banner', 'sink-list']); | 501 checkElementsVisibleWithId(['container-header', |
| 502 'issue-banner', |
| 503 'sink-list']); |
| 500 done(); | 504 done(); |
| 501 }); | 505 }); |
| 502 }); | 506 }); |
| 503 | 507 |
| 504 // Tests that the sink list does not contain any sinks that are not | 508 // Tests that the sink list does not contain any sinks that are not |
| 505 // compatible with the current cast mode and are not associated with a | 509 // compatible with the current cast mode and are not associated with a |
| 506 // route. | 510 // route. |
| 507 test('sink list filtering based on initial cast mode', function(done) { | 511 test('sink list filtering based on initial cast mode', function(done) { |
| 508 var newSinks = [ | 512 var newSinks = [ |
| 509 new media_router.Sink('sink id 10', 'Sink 10', | 513 new media_router.Sink('sink id 10', 'Sink 10', |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 }); | 575 }); |
| 572 }); | 576 }); |
| 573 }); | 577 }); |
| 574 }); | 578 }); |
| 575 } | 579 } |
| 576 | 580 |
| 577 return { | 581 return { |
| 578 registerTests: registerTests, | 582 registerTests: registerTests, |
| 579 }; | 583 }; |
| 580 }); | 584 }); |
| OLD | NEW |