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

Unified Diff: chrome/test/data/webui/settings/device_page_tests.js

Issue 2110833003: MD Settings: Add mouse settings, update pointer settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PointersFake
Patch Set: Created 4 years, 6 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
Index: chrome/test/data/webui/settings/device_page_tests.js
diff --git a/chrome/test/data/webui/settings/device_page_tests.js b/chrome/test/data/webui/settings/device_page_tests.js
index 5ce176681f2f020682f61f5a3acd36fe878df782..43217435e841d10c4ad903adcdffb810dd68344b 100644
--- a/chrome/test/data/webui/settings/device_page_tests.js
+++ b/chrome/test/data/webui/settings/device_page_tests.js
@@ -5,9 +5,10 @@
cr.define('device_page_tests', function() {
/** @enum {string} */
var TestNames = {
+ DevicePage: 'device page',
Display: 'display',
Keyboard: 'keyboard',
- Touchpad: 'touchpad',
+ Pointers: 'pointers',
};
/**
@@ -19,6 +20,13 @@ cr.define('device_page_tests', function() {
}
TestDevicePageBrowserProxy.prototype = {
+ /** override */
+ initializePointers: function() {
+ // Enable mouse and touchpad.
+ cr.webUIListenerCallback('has-mouse-changed', true);
+ cr.webUIListenerCallback('has-touchpad-changed', true);
+ },
+
/** @override */
handleLinkEvent: function(e) {
settings.DevicePageBrowserProxyImpl.prototype.handleLinkEvent.call(
@@ -55,6 +63,23 @@ cr.define('device_page_tests', function() {
type: chrome.settingsPrivate.PrefType.BOOLEAN,
value: false,
},
+ sensitivity2: {
+ key: 'settings.touchpad.sensitivity2',
+ type: chrome.settingsPrivate.PrefType.NUMBER,
+ value: 3,
+ },
+ },
+ mouse: {
+ primary_right: {
+ key: 'settings.mouse.primary_right',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: false,
+ },
+ sensitivity2: {
+ key: 'settings.mouse.sensitivity2',
+ type: chrome.settingsPrivate.PrefType.NUMBER,
+ value: 4,
+ },
},
language: {
xkb_remap_search_key_to: {
@@ -153,14 +178,14 @@ cr.define('device_page_tests', function() {
};
/**
- * @param {!HTMLElement} touchpadPage
+ * @param {!HTMLElement} pointersPage
* @param {Boolean} expected
*/
- function expectNaturalScrollValue(touchpadPage, expected) {
+ function expectNaturalScrollValue(pointersPage, expected) {
var naturalScrollOff =
- touchpadPage.$$('paper-radio-button[name="false"]');
+ pointersPage.$$('paper-radio-button[name="false"]');
var naturalScrollOn =
- touchpadPage.$$('paper-radio-button[name="true"]');
+ pointersPage.$$('paper-radio-button[name="true"]');
assertTrue(!!naturalScrollOff);
assertTrue(!!naturalScrollOn);
@@ -170,39 +195,86 @@ cr.define('device_page_tests', function() {
devicePage.prefs.settings.touchpad.natural_scroll.value);
}
- test(assert(TestNames.Touchpad), function(done) {
- showAndGetDeviceSubpage('touchpad').then(function(touchpadPage) {
- expectNaturalScrollValue(touchpadPage, false);
+ test(assert(TestNames.DevicePage), function() {
+ expectLT(0, devicePage.$.pointersRow.offsetHeight);
+ expectLT(0, devicePage.$.keyboardRow.offsetHeight);
+ expectLT(0, devicePage.$.displayRow.offsetHeight);
+
+ cr.webUIListenerCallback('has-mouse-changed', false);
+ expectLT(0, devicePage.$.pointersRow.offsetHeight);
+ cr.webUIListenerCallback('has-touchpad-changed', false);
+ expectEquals(0, devicePage.$.pointersRow.offsetHeight);
+ cr.webUIListenerCallback('has-mouse-changed', true);
+ expectLT(0, devicePage.$.pointersRow.offsetHeight);
+ });
- // Tapping the link shouldn't enable the radio button.
- var naturalScrollOn =
- touchpadPage.$$('paper-radio-button[name="true"]');
- var a = naturalScrollOn.querySelector('a');
+ suite(assert(TestNames.Pointers), function() {
+ test('subpage', function() {
+ return showAndGetDeviceSubpage('pointers').then(function(pointersPage) {
+ expectLT(0, pointersPage.$.mouse.offsetHeight);
+ expectLT(0, pointersPage.$.touchpad.offsetHeight);
+ expectLT(0, pointersPage.$$('#mouse h2').offsetHeight);
+ expectLT(0, pointersPage.$$('#touchpad h2').offsetHeight);
+
+ cr.webUIListenerCallback('has-touchpad-changed', false);
+ expectLT(0, pointersPage.$.mouse.offsetHeight);
+ expectEquals(0, pointersPage.$.touchpad.offsetHeight);
+ expectEquals(0, pointersPage.$$('#mouse h2').offsetHeight);
+ expectEquals(0, pointersPage.$$('#touchpad h2').offsetHeight);
+
+ cr.webUIListenerCallback('has-mouse-changed', false);
+ expectEquals(0, pointersPage.$.mouse.offsetHeight);
+ expectEquals(0, pointersPage.$.touchpad.offsetHeight);
+ expectEquals(0, pointersPage.$$('#mouse h2').offsetHeight);
+ expectEquals(0, pointersPage.$$('#touchpad h2').offsetHeight);
+
+ cr.webUIListenerCallback('has-touchpad-changed', true);
+ expectEquals(0, pointersPage.$.mouse.offsetHeight);
+ expectLT(0, pointersPage.$.touchpad.offsetHeight);
+ expectEquals(0, pointersPage.$$('#mouse h2').offsetHeight);
+ expectEquals(0, pointersPage.$$('#touchpad h2').offsetHeight);
+
+ cr.webUIListenerCallback('has-mouse-changed', true);
+ expectLT(0, pointersPage.$.mouse.offsetHeight);
+ expectLT(0, pointersPage.$.touchpad.offsetHeight);
+ expectLT(0, pointersPage.$$('#mouse h2').offsetHeight);
+ expectLT(0, pointersPage.$$('#touchpad h2').offsetHeight);
+ });
+ });
- MockInteractions.tap(a);
- expectNaturalScrollValue(touchpadPage, false);
+ test('link doesn\'t activate control', function(done) {
+ showAndGetDeviceSubpage('pointers').then(function(pointersPage) {
+ expectNaturalScrollValue(pointersPage, false);
- MockInteractions.tap(naturalScrollOn);
- expectNaturalScrollValue(touchpadPage, true);
+ // Tapping the link shouldn't enable the radio button.
+ var naturalScrollOn =
+ pointersPage.$$('paper-radio-button[name="true"]');
+ var a = naturalScrollOn.querySelector('a');
- devicePage.set('prefs.settings.touchpad.natural_scroll.value', false);
- expectNaturalScrollValue(touchpadPage, false);
+ MockInteractions.tap(a);
+ expectNaturalScrollValue(pointersPage, false);
- // Enter on the link shouldn't enable the radio button either.
- MockInteractions.pressEnter(a);
+ MockInteractions.tap(naturalScrollOn);
+ expectNaturalScrollValue(pointersPage, true);
+ devicePage.set('prefs.settings.touchpad.natural_scroll.value', false);
+ expectNaturalScrollValue(pointersPage, false);
- // Annoyingly, we have to schedule an async event with a timeout greater
- // than or equal to the timeout used by IronButtonState (1).
- // https://github.com/PolymerElements/iron-behaviors/issues/54
- Polymer.Base.async(function() {
- expectNaturalScrollValue(touchpadPage, false);
+ // Enter on the link shouldn't enable the radio button either.
+ MockInteractions.pressEnter(a);
- MockInteractions.pressEnter(naturalScrollOn);
+ // Annoyingly, we have to schedule an async event with a timeout
+ // greater than or equal to the timeout used by IronButtonState (1).
+ // https://github.com/PolymerElements/iron-behaviors/issues/54
Polymer.Base.async(function() {
- expectNaturalScrollValue(touchpadPage, true);
- done();
+ expectNaturalScrollValue(pointersPage, false);
+
+ MockInteractions.pressEnter(naturalScrollOn);
+ Polymer.Base.async(function() {
+ expectNaturalScrollValue(pointersPage, true);
+ done();
+ }, 1);
}, 1);
- }, 1);
+ });
});
});

Powered by Google App Engine
This is Rietveld 408576698