| 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_device_page', function() { | 5 cr.define('settings_device_page', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.DevicePageBrowserProxy} | 8 * @implements {settings.DevicePageBrowserProxy} |
| 9 */ | 9 */ |
| 10 function TestDevicePageBrowserProxy() {} | 10 function TestDevicePageBrowserProxy() { |
| 11 this.keyboardShortcutsOverlayShown_ = 0; |
| 12 } |
| 11 | 13 |
| 12 TestDevicePageBrowserProxy.prototype = { | 14 TestDevicePageBrowserProxy.prototype = { |
| 13 /** @override */ | 15 /** @override */ |
| 14 handleLinkEvent: function(e) { | 16 handleLinkEvent: function(e) { |
| 15 settings.DevicePageBrowserProxyImpl.prototype.handleLinkEvent.call( | 17 settings.DevicePageBrowserProxyImpl.prototype.handleLinkEvent.call( |
| 16 this, e); | 18 this, e); |
| 17 // Prevent opening the link, which can block the test. | 19 // Prevent opening the link, which can block the test. |
| 18 e.preventDefault(); | 20 e.preventDefault(); |
| 19 }, | 21 }, |
| 22 |
| 23 /** override */ |
| 24 initializeKeyboard: function() {}, |
| 25 |
| 26 /** override */ |
| 27 showKeyboardShortcutsOverlay: function() { |
| 28 this.keyboardShortcutsOverlayShown_++; |
| 29 }, |
| 20 }; | 30 }; |
| 21 | 31 |
| 22 suite('SettingsDevicePage', function() { | 32 suite('SettingsDevicePage', function() { |
| 23 var fakePrefs = { | 33 var fakePrefs = { |
| 24 settings: { | 34 settings: { |
| 25 touchpad: { | 35 touchpad: { |
| 26 enable_tap_to_click: { | 36 enable_tap_to_click: { |
| 27 key: 'settings.touchpad.enable_tap_to_click', | 37 key: 'settings.touchpad.enable_tap_to_click', |
| 28 type: chrome.settingsPrivate.PrefType.BOOLEAN, | 38 type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| 29 value: true, | 39 value: true, |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 devicePage.set( | 243 devicePage.set( |
| 234 'prefs.settings.language.xkb_auto_repeat_delay_r2.value', 600); | 244 'prefs.settings.language.xkb_auto_repeat_delay_r2.value', 600); |
| 235 expectEquals(keyboardPage.$.delaySlider.immediateValue, 3 /* 500 */); | 245 expectEquals(keyboardPage.$.delaySlider.immediateValue, 3 /* 500 */); |
| 236 devicePage.set( | 246 devicePage.set( |
| 237 'prefs.settings.language.xkb_auto_repeat_interval_r2.value', 45); | 247 'prefs.settings.language.xkb_auto_repeat_interval_r2.value', 45); |
| 238 expectEquals(keyboardPage.$.repeatRateSlider.immediateValue, 6 /* 50 */); | 248 expectEquals(keyboardPage.$.repeatRateSlider.immediateValue, 6 /* 50 */); |
| 239 | 249 |
| 240 devicePage.set( | 250 devicePage.set( |
| 241 'prefs.settings.language.xkb_auto_repeat_enabled_r2.value', false); | 251 'prefs.settings.language.xkb_auto_repeat_enabled_r2.value', false); |
| 242 expectFalse(collapse.opened); | 252 expectFalse(collapse.opened); |
| 253 |
| 254 // Test keyboard shortcut overlay button. |
| 255 MockInteractions.tap(keyboardPage.$$('#keyboardOverlay')); |
| 256 expectEquals( |
| 257 1, |
| 258 settings.DevicePageBrowserProxyImpl.getInstance() |
| 259 .keyboardShortcutsOverlayShown_); |
| 243 }); | 260 }); |
| 244 | 261 |
| 245 // Test more edge cases for slider rounding logic. | 262 // Test more edge cases for slider rounding logic. |
| 246 // TODO(michaelpg): Move this test to settings-slider tests once that | 263 // TODO(michaelpg): Move this test to settings-slider tests once that |
| 247 // element is created. | 264 // element is created. |
| 248 test('keyboard sliders', function() { | 265 test('keyboard sliders', function() { |
| 249 var keyboardPage = showAndGetDeviceSubpage('keyboard'); | 266 var keyboardPage = showAndGetDeviceSubpage('keyboard'); |
| 250 assertTrue(!!keyboardPage); | 267 assertTrue(!!keyboardPage); |
| 251 | 268 |
| 252 var testArray = [80, 20, 350, 1000, 200, 100]; | 269 var testArray = [80, 20, 350, 1000, 200, 100]; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 expectTrue(displayPage.showMirror_(displayPage.displays)); | 377 expectTrue(displayPage.showMirror_(displayPage.displays)); |
| 361 expectTrue(displayPage.isMirrored_(displayPage.displays)); | 378 expectTrue(displayPage.isMirrored_(displayPage.displays)); |
| 362 }); | 379 }); |
| 363 }); | 380 }); |
| 364 }); | 381 }); |
| 365 }); | 382 }); |
| 366 }); | 383 }); |
| 367 }); | 384 }); |
| 368 }); | 385 }); |
| 369 }); | 386 }); |
| OLD | NEW |