| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 suite('no power settings', function() { | 581 suite('no power settings', function() { |
| 582 test('power row hidden', function() { | 582 test('power row hidden', function() { |
| 583 assertEquals(null, devicePage.$$('#powerRow')); | 583 assertEquals(null, devicePage.$$('#powerRow')); |
| 584 assertEquals(0, | 584 assertEquals(0, |
| 585 settings.DevicePageBrowserProxyImpl.getInstance() | 585 settings.DevicePageBrowserProxyImpl.getInstance() |
| 586 .updatePowerStatusCalled_); | 586 .updatePowerStatusCalled_); |
| 587 }); | 587 }); |
| 588 }); | 588 }); |
| 589 | 589 |
| 590 suite('power settings', function() { | 590 suite('power settings', function() { |
| 591 var powerRow; | 591 var powerPage; |
| 592 var powerSourceRow; |
| 592 var powerSourceWrapper; | 593 var powerSourceWrapper; |
| 593 var powerSourceSelect; | 594 var powerSourceSelect; |
| 594 | 595 |
| 595 suiteSetup(function() { | 596 suiteSetup(function() { |
| 596 // Always show power settings. | 597 // Always show power settings. |
| 597 loadTimeData.overrideValues({ | 598 loadTimeData.overrideValues({ |
| 598 enablePowerSettings: true, | 599 enablePowerSettings: true, |
| 599 }); | 600 }); |
| 600 }); | 601 }); |
| 601 | 602 |
| 602 setup(function() { | 603 setup(function() { |
| 603 powerRow = assert(devicePage.$$('#powerRow')); | 604 return showAndGetDeviceSubpage('power', settings.Route.POWER) |
| 604 powerSourceWrapper = | 605 .then(function(page) { |
| 605 assert(powerRow.querySelector('.md-select-wrapper')); | 606 powerPage = page; |
| 606 powerSourceSelect = assert(devicePage.$$('#powerSource')); | 607 powerSourceRow = assert(powerPage.$$('#powerSourceRow')); |
| 607 assertEquals(1, | 608 powerSourceWrapper = |
| 608 settings.DevicePageBrowserProxyImpl.getInstance() | 609 assert(powerSourceRow.querySelector('.md-select-wrapper')); |
| 609 .updatePowerStatusCalled_); | 610 powerSourceSelect = assert(powerPage.$$('#powerSource')); |
| 611 assertEquals( |
| 612 1, |
| 613 settings.DevicePageBrowserProxyImpl.getInstance() |
| 614 .updatePowerStatusCalled_); |
| 615 }); |
| 610 }); | 616 }); |
| 611 | 617 |
| 612 test('power sources', function() { | 618 test('power sources', function() { |
| 613 var batteryStatus = { | 619 var batteryStatus = { |
| 614 charging: false, | 620 charging: false, |
| 615 calculating: false, | 621 calculating: false, |
| 616 percent: 50, | 622 percent: 50, |
| 617 statusText: '5 hours left', | 623 statusText: '5 hours left', |
| 618 }; | 624 }; |
| 619 cr.webUIListenerCallback( | 625 cr.webUIListenerCallback( |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 assert(waitingDiv.hidden); | 806 assert(waitingDiv.hidden); |
| 801 assert(!selectAppDiv.hidden); | 807 assert(!selectAppDiv.hidden); |
| 802 }); | 808 }); |
| 803 }); | 809 }); |
| 804 }); | 810 }); |
| 805 | 811 |
| 806 return { | 812 return { |
| 807 TestNames: TestNames | 813 TestNames: TestNames |
| 808 }; | 814 }; |
| 809 }); | 815 }); |
| OLD | NEW |