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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/system_page_tests.js
diff --git a/chrome/test/data/webui/settings/system_page_tests.js b/chrome/test/data/webui/settings/system_page_tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..27ff9a50e51fc2a9ff8a0f55a852f43fc9a3b7a8
--- /dev/null
+++ b/chrome/test/data/webui/settings/system_page_tests.js
@@ -0,0 +1,87 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings_system_page', function() {
+ /** @const {boolean} */
+ var HARDWARE_ACCELERATION_AT_STARTUP = true;
+
+ /**
+ * @constructor
+ * @extends {TestBrowserProxy}
+ * @implements {settings.SystemPageBrowserProxy}
+ */
+ function TestSystemPageBrowserProxy() {
+ settings.TestBrowserProxy.call(this, ['restartBrowser']);
+ }
+
+ TestSystemPageBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ changeProxySettings: assertNotReached,
+
+ /** @override */
+ restartBrowser: function() {
+ this.methodCalled('restartBrowser');
+ },
+
+ /** @override */
+ wasHardwareAccelerationEnabledAtStartup: function() {
+ return HARDWARE_ACCELERATION_AT_STARTUP;
+ },
+ };
+
+ suite('SettingsDevicePage', function() {
+ /** @type {settings.TestSystemPageBrowserProxy} */
+ var testBrowserProxy;
+
+ /** @type {SettingsSystemPageElement} */
+ var systemPage;
+
+ setup(function() {
+ testBrowserProxy = new TestSystemPageBrowserProxy;
+ settings.SystemPageBrowserProxyImpl.instance_ = testBrowserProxy;
+
+ systemPage = document.createElement('settings-system-page');
+ systemPage.set('prefs', {
+ background_mode: {
+ enabled: {
+ key: 'background_mode.enabled',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: true,
+ },
+ },
+ hardware_acceleration_mode: {
+ enabled: {
+ key: 'hardware_acceleration_mode.enabled',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: HARDWARE_ACCELERATION_AT_STARTUP,
+ },
+ },
+ });
+ document.body.appendChild(systemPage);
+ });
+
+ teardown(function() { systemPage.remove(); });
+
+ test('restart button', function() {
+ var checkbox = systemPage.$$('#hardware-acceleration settings-checkbox');
+ expectEquals(checkbox.checked, HARDWARE_ACCELERATION_AT_STARTUP);
+
+ // Restart button should be hidden by default.
+ expectFalse(!!systemPage.$$('#hardware-acceleration paper-button'));
+
+ systemPage.set('prefs.hardware_acceleration_mode.enabled.value',
+ !HARDWARE_ACCELERATION_AT_STARTUP);
+ Polymer.dom.flush();
+ expectNotEquals(checkbox.checked, HARDWARE_ACCELERATION_AT_STARTUP);
+
+ var restart = systemPage.$$('#hardware-acceleration paper-button');
+ expectTrue(!!restart); // The "RESTART" button should be showing now.
+
+ MockInteractions.tap(restart);
+ return testBrowserProxy.whenCalled('restartBrowser');
+ });
+ });
+});
« 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