| 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('settings_system_page', function() { | 5 cr.define('settings_system_page', function() { |
| 6 /** @const {boolean} */ | 6 /** @const {boolean} */ |
| 7 var HARDWARE_ACCELERATION_AT_STARTUP = true; | 7 var HARDWARE_ACCELERATION_AT_STARTUP = true; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * @constructor | 10 * @constructor |
| 11 * @extends {TestBrowserProxy} | 11 * @extends {TestBrowserProxy} |
| 12 * @implements {settings.SystemPageBrowserProxy} | 12 * @implements {settings.SystemPageBrowserProxy} |
| 13 */ | 13 */ |
| 14 function TestSystemPageBrowserProxy() { | 14 function TestSystemPageBrowserProxy() { |
| 15 settings.TestBrowserProxy.call(this, ['restartBrowser']); | 15 settings.TestBrowserProxy.call(this, []); |
| 16 } | 16 } |
| 17 | 17 |
| 18 TestSystemPageBrowserProxy.prototype = { | 18 TestSystemPageBrowserProxy.prototype = { |
| 19 __proto__: settings.TestBrowserProxy.prototype, | 19 __proto__: settings.TestBrowserProxy.prototype, |
| 20 | 20 |
| 21 /** @override */ | 21 /** @override */ |
| 22 changeProxySettings: assertNotReached, | 22 changeProxySettings: assertNotReached, |
| 23 | 23 |
| 24 /** @override */ | 24 /** @override */ |
| 25 restartBrowser: function() { | |
| 26 this.methodCalled('restartBrowser'); | |
| 27 }, | |
| 28 | |
| 29 /** @override */ | |
| 30 wasHardwareAccelerationEnabledAtStartup: function() { | 25 wasHardwareAccelerationEnabledAtStartup: function() { |
| 31 return HARDWARE_ACCELERATION_AT_STARTUP; | 26 return HARDWARE_ACCELERATION_AT_STARTUP; |
| 32 }, | 27 }, |
| 33 }; | 28 }; |
| 34 | 29 |
| 35 suite('SettingsDevicePage', function() { | 30 suite('SettingsDevicePage', function() { |
| 36 /** @type {settings.TestSystemPageBrowserProxy} */ | 31 /** @type {TestSystemPageBrowserProxy} */ |
| 37 var testBrowserProxy; | 32 var systemBrowserProxy; |
| 33 |
| 34 /** @type {settings.TestLifetimeBrowserProxy} */ |
| 35 var lifetimeBrowserProxy; |
| 38 | 36 |
| 39 /** @type {SettingsSystemPageElement} */ | 37 /** @type {SettingsSystemPageElement} */ |
| 40 var systemPage; | 38 var systemPage; |
| 41 | 39 |
| 42 setup(function() { | 40 setup(function() { |
| 43 testBrowserProxy = new TestSystemPageBrowserProxy; | 41 lifetimeBrowserProxy = new settings.TestLifetimeBrowserProxy(); |
| 44 settings.SystemPageBrowserProxyImpl.instance_ = testBrowserProxy; | 42 settings.LifetimeBrowserProxyImpl.instance_ = lifetimeBrowserProxy; |
| 43 settings.SystemPageBrowserProxyImpl.instance_ = |
| 44 new TestSystemPageBrowserProxy(); |
| 45 | 45 |
| 46 systemPage = document.createElement('settings-system-page'); | 46 systemPage = document.createElement('settings-system-page'); |
| 47 systemPage.set('prefs', { | 47 systemPage.set('prefs', { |
| 48 background_mode: { | 48 background_mode: { |
| 49 enabled: { | 49 enabled: { |
| 50 key: 'background_mode.enabled', | 50 key: 'background_mode.enabled', |
| 51 type: chrome.settingsPrivate.PrefType.BOOLEAN, | 51 type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| 52 value: true, | 52 value: true, |
| 53 }, | 53 }, |
| 54 }, | 54 }, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 | 74 |
| 75 systemPage.set('prefs.hardware_acceleration_mode.enabled.value', | 75 systemPage.set('prefs.hardware_acceleration_mode.enabled.value', |
| 76 !HARDWARE_ACCELERATION_AT_STARTUP); | 76 !HARDWARE_ACCELERATION_AT_STARTUP); |
| 77 Polymer.dom.flush(); | 77 Polymer.dom.flush(); |
| 78 expectNotEquals(checkbox.checked, HARDWARE_ACCELERATION_AT_STARTUP); | 78 expectNotEquals(checkbox.checked, HARDWARE_ACCELERATION_AT_STARTUP); |
| 79 | 79 |
| 80 var restart = systemPage.$$('#hardware-acceleration paper-button'); | 80 var restart = systemPage.$$('#hardware-acceleration paper-button'); |
| 81 expectTrue(!!restart); // The "RESTART" button should be showing now. | 81 expectTrue(!!restart); // The "RESTART" button should be showing now. |
| 82 | 82 |
| 83 MockInteractions.tap(restart); | 83 MockInteractions.tap(restart); |
| 84 return testBrowserProxy.whenCalled('restartBrowser'); | 84 return lifetimeBrowserProxy.whenCalled('restart'); |
| 85 }); | 85 }); |
| 86 }); | 86 }); |
| 87 }); | 87 }); |
| OLD | NEW |