| 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 cr.define('device_page_tests', function() { | 5 cr.define('device_page_tests', function() { |
| 6 /** @enum {string} */ | 6 /** @enum {string} */ |
| 7 var TestNames = { | 7 var TestNames = { |
| 8 DevicePage: 'device page', | 8 DevicePage: 'device page', |
| 9 Display: 'display', | 9 Display: 'display', |
| 10 Keyboard: 'keyboard', | 10 Keyboard: 'keyboard', |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 fakeSystemDisplay.getLayoutCalled.promise, | 481 fakeSystemDisplay.getLayoutCalled.promise, |
| 482 ]); | 482 ]); |
| 483 }).then(function() { | 483 }).then(function() { |
| 484 // There should be a single display which should be primary and | 484 // There should be a single display which should be primary and |
| 485 // selected. Mirroring should be disabled. | 485 // selected. Mirroring should be disabled. |
| 486 expectEquals(1, displayPage.displays.length); | 486 expectEquals(1, displayPage.displays.length); |
| 487 expectEquals( | 487 expectEquals( |
| 488 displayPage.displays[0].id, displayPage.selectedDisplay.id); | 488 displayPage.displays[0].id, displayPage.selectedDisplay.id); |
| 489 expectEquals( | 489 expectEquals( |
| 490 displayPage.displays[0].id, displayPage.primaryDisplayId); | 490 displayPage.displays[0].id, displayPage.primaryDisplayId); |
| 491 expectFalse(displayPage.showMirror_(displayPage.displays)); | 491 expectFalse(displayPage.showMirror_(false, displayPage.displays)); |
| 492 expectFalse(displayPage.isMirrored_(displayPage.displays)); | 492 expectFalse(displayPage.isMirrored_(displayPage.displays)); |
| 493 | 493 |
| 494 // Add a second display. | 494 // Add a second display. |
| 495 addDisplay(2); | 495 addDisplay(2); |
| 496 fakeSystemDisplay.onDisplayChanged.callListeners(); | 496 fakeSystemDisplay.onDisplayChanged.callListeners(); |
| 497 | 497 |
| 498 return Promise.all([ | 498 return Promise.all([ |
| 499 fakeSystemDisplay.getInfoCalled.promise, | 499 fakeSystemDisplay.getInfoCalled.promise, |
| 500 fakeSystemDisplay.getLayoutCalled.promise, | 500 fakeSystemDisplay.getLayoutCalled.promise, |
| 501 new Promise(function(resolve, reject) { setTimeout(resolve); }) | 501 new Promise(function(resolve, reject) { setTimeout(resolve); }) |
| 502 ]); | 502 ]); |
| 503 }).then(function() { | 503 }).then(function() { |
| 504 // There should be two displays, the first should be primary and | 504 // There should be two displays, the first should be primary and |
| 505 // selected. Mirroring should be enabled but set to false. | 505 // selected. Mirroring should be enabled but set to false. |
| 506 expectEquals(2, displayPage.displays.length); | 506 expectEquals(2, displayPage.displays.length); |
| 507 expectEquals( | 507 expectEquals( |
| 508 displayPage.displays[0].id, displayPage.selectedDisplay.id); | 508 displayPage.displays[0].id, displayPage.selectedDisplay.id); |
| 509 expectEquals(displayPage.displays[0].id, displayPage.primaryDisplayId); | 509 expectEquals(displayPage.displays[0].id, displayPage.primaryDisplayId); |
| 510 expectTrue(displayPage.showMirror_(displayPage.displays)); | 510 expectTrue(displayPage.showMirror_(false, displayPage.displays)); |
| 511 expectFalse(displayPage.isMirrored_(displayPage.displays)); | 511 expectFalse(displayPage.isMirrored_(displayPage.displays)); |
| 512 | 512 |
| 513 // Select the second display and make it primary. Also change the | 513 // Select the second display and make it primary. Also change the |
| 514 // orientation of the second display. | 514 // orientation of the second display. |
| 515 var displayLayout = displayPage.$$('#displayLayout'); | 515 var displayLayout = displayPage.$$('#displayLayout'); |
| 516 assertTrue(!!displayLayout); | 516 assertTrue(!!displayLayout); |
| 517 var displayDiv = displayLayout.$$('#_fakeDisplayId2'); | 517 var displayDiv = displayLayout.$$('#_fakeDisplayId2'); |
| 518 assertTrue(!!displayDiv); | 518 assertTrue(!!displayDiv); |
| 519 MockInteractions.tap(displayDiv); | 519 MockInteractions.tap(displayDiv); |
| 520 expectEquals( | 520 expectEquals( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 547 fakeSystemDisplay.getLayoutCalled.promise, | 547 fakeSystemDisplay.getLayoutCalled.promise, |
| 548 new Promise(function(resolve, reject) { setTimeout(resolve); }) | 548 new Promise(function(resolve, reject) { setTimeout(resolve); }) |
| 549 ]); | 549 ]); |
| 550 }).then(function() { | 550 }).then(function() { |
| 551 // Confirm that there is now only one display and that it is primary | 551 // Confirm that there is now only one display and that it is primary |
| 552 // and mirroring is enabled. | 552 // and mirroring is enabled. |
| 553 expectEquals(1, displayPage.displays.length); | 553 expectEquals(1, displayPage.displays.length); |
| 554 expectEquals( | 554 expectEquals( |
| 555 displayPage.displays[0].id, displayPage.selectedDisplay.id); | 555 displayPage.displays[0].id, displayPage.selectedDisplay.id); |
| 556 expectTrue(displayPage.displays[0].isPrimary); | 556 expectTrue(displayPage.displays[0].isPrimary); |
| 557 expectTrue(displayPage.showMirror_(displayPage.displays)); | 557 expectTrue(displayPage.showMirror_(false, displayPage.displays)); |
| 558 expectTrue(displayPage.isMirrored_(displayPage.displays)); | 558 expectTrue(displayPage.isMirrored_(displayPage.displays)); |
| 559 }); | 559 }); |
| 560 }); | 560 }); |
| 561 | 561 |
| 562 suite(assert(TestNames.Power), function() { | 562 suite(assert(TestNames.Power), function() { |
| 563 /** | 563 /** |
| 564 * Sets power sources using a deep copy of |sources|. | 564 * Sets power sources using a deep copy of |sources|. |
| 565 * @param {Array<settings.PowerSource>} sources | 565 * @param {Array<settings.PowerSource>} sources |
| 566 * @param {string} powerSourceId | 566 * @param {string} powerSourceId |
| 567 * @param {bool} isLowPowerCharger | 567 * @param {bool} isLowPowerCharger |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 assert(waitingDiv.hidden); | 802 assert(waitingDiv.hidden); |
| 803 assert(!selectAppDiv.hidden); | 803 assert(!selectAppDiv.hidden); |
| 804 }); | 804 }); |
| 805 }); | 805 }); |
| 806 }); | 806 }); |
| 807 | 807 |
| 808 return { | 808 return { |
| 809 TestNames: TestNames | 809 TestNames: TestNames |
| 810 }; | 810 }; |
| 811 }); | 811 }); |
| OLD | NEW |