Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/test/data/webui/settings/system_page_tests.js

Issue 1814703004: MD Settings: implement "RESTART" button for hardware acceleration to take effect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('settings_system_page', function() {
6 /** @const {boolean} */
7 var HARDWARE_ACCELERATION_AT_STARTUP = true;
8
9 /**
10 * @constructor
11 * @extends {TestBrowserProxy}
12 * @implements {settings.SystemPageBrowserProxy}
13 */
14 function TestSystemPageBrowserProxy() {
15 settings.TestBrowserProxy.call(this, ['restartBrowser']);
16 }
17
18 TestSystemPageBrowserProxy.prototype = {
19 __proto__: settings.TestBrowserProxy.prototype,
20
21 /** @override */
22 changeProxySettings: assertNotReached,
23
24 /** @override */
25 restartBrowser: function() {
26 this.methodCalled('restartBrowser');
27 },
28
29 /** @override */
30 wasHardwareAccelerationEnabledAtStartup: function() {
31 return HARDWARE_ACCELERATION_AT_STARTUP;
32 },
33 };
34
35 suite('SettingsDevicePage', function() {
36 /** @type {settings.TestSystemPageBrowserProxy} */
37 var testBrowserProxy;
38
39 /** @type {SettingsSystemPageElement} */
40 var systemPage;
41
42 setup(function() {
43 testBrowserProxy = new TestSystemPageBrowserProxy;
44 settings.SystemPageBrowserProxyImpl.instance_ = testBrowserProxy;
45
46 systemPage = document.createElement('settings-system-page');
47 systemPage.set('prefs', {
48 background_mode: {
49 enabled: {
50 key: 'background_mode.enabled',
51 type: chrome.settingsPrivate.PrefType.BOOLEAN,
52 value: true,
53 },
54 },
55 hardware_acceleration_mode: {
56 enabled: {
57 key: 'hardware_acceleration_mode.enabled',
58 type: chrome.settingsPrivate.PrefType.BOOLEAN,
59 value: HARDWARE_ACCELERATION_AT_STARTUP,
60 },
61 },
62 });
63 document.body.appendChild(systemPage);
64 });
65
66 teardown(function() { systemPage.remove(); });
67
68 test('restart button', function() {
69 var checkbox = systemPage.$$('#hardware-acceleration settings-checkbox');
70 expectEquals(checkbox.checked, HARDWARE_ACCELERATION_AT_STARTUP);
71
72 // Restart button should be hidden by default.
73 expectFalse(!!systemPage.$$('#hardware-acceleration paper-button'));
74
75 systemPage.set('prefs.hardware_acceleration_mode.enabled.value',
76 !HARDWARE_ACCELERATION_AT_STARTUP);
77 Polymer.dom.flush();
78 expectNotEquals(checkbox.checked, HARDWARE_ACCELERATION_AT_STARTUP);
79
80 var restart = systemPage.$$('#hardware-acceleration paper-button');
81 expectTrue(!!restart); // The "RESTART" button should be showing now.
82
83 MockInteractions.tap(restart);
84 return testBrowserProxy.whenCalled('restartBrowser');
85 });
86 });
87 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698