Commit 69e3a2a3 authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[DevicePage] Turn Display and Keyboard tests into suites

Allows the addition of further display and keyboard tests needed to
test out deep linking.

Bug: 1084154
Change-Id: I9b66ee94364403fa977bdb3b14c29d748114a555
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2372814Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Daniel Classon <dclasson@google.com>
Cr-Commit-Position: refs/heads/master@{#801195}
parent ecf5d675
...@@ -694,346 +694,355 @@ cr.define('device_page_tests', function() { ...@@ -694,346 +694,355 @@ cr.define('device_page_tests', function() {
}); });
}); });
test(assert(TestNames.Keyboard), async () => { suite(assert(TestNames.Keyboard), function() {
const name = k => `prefs.settings.language.${k}.value`; const name = k => `prefs.settings.language.${k}.value`;
const get = k => devicePage.get(name(k)); const get = k => devicePage.get(name(k));
const set = (k, v) => devicePage.set(name(k), v); const set = (k, v) => devicePage.set(name(k), v);
// Open the keyboard subpage. let keyboardPage;
const keyboardPage =
await showAndGetDeviceSubpage('keyboard', settings.routes.KEYBOARD); setup(async () => {
// Initially, the optional keys are hidden. keyboardPage =
expectFalse(!!keyboardPage.$$('#capsLockKey')); await showAndGetDeviceSubpage('keyboard', settings.routes.KEYBOARD);
});
// Pretend no internal keyboard is available.
const keyboardParams = { test('keyboard', async () => {
'showCapsLock': false, // Initially, the optional keys are hidden.
'showExternalMetaKey': false, expectFalse(!!keyboardPage.$$('#capsLockKey'));
'showAppleCommandKey': false,
'hasInternalKeyboard': false, // Pretend no internal keyboard is available.
'hasAssistantKey': false, const keyboardParams = {
}; 'showCapsLock': false,
cr.webUIListenerCallback('show-keys-changed', keyboardParams); 'showExternalMetaKey': false,
Polymer.dom.flush(); 'showAppleCommandKey': false,
expectFalse(!!keyboardPage.$$('#internalSearchKey')); 'hasInternalKeyboard': false,
expectFalse(!!keyboardPage.$$('#capsLockKey')); 'hasAssistantKey': false,
expectFalse(!!keyboardPage.$$('#externalMetaKey')); };
expectFalse(!!keyboardPage.$$('#externalCommandKey')); cr.webUIListenerCallback('show-keys-changed', keyboardParams);
expectFalse(!!keyboardPage.$$('#assistantKey')); Polymer.dom.flush();
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
// Pretend a Caps Lock key is now available. expectFalse(!!keyboardPage.$$('#capsLockKey'));
keyboardParams['showCapsLock'] = true; expectFalse(!!keyboardPage.$$('#externalMetaKey'));
cr.webUIListenerCallback('show-keys-changed', keyboardParams); expectFalse(!!keyboardPage.$$('#externalCommandKey'));
Polymer.dom.flush(); expectFalse(!!keyboardPage.$$('#assistantKey'));
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
expectTrue(!!keyboardPage.$$('#capsLockKey')); // Pretend a Caps Lock key is now available.
expectFalse(!!keyboardPage.$$('#externalMetaKey')); keyboardParams['showCapsLock'] = true;
expectFalse(!!keyboardPage.$$('#externalCommandKey')); cr.webUIListenerCallback('show-keys-changed', keyboardParams);
expectFalse(!!keyboardPage.$$('#assistantKey')); Polymer.dom.flush();
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
// Add a non-Apple external keyboard. expectTrue(!!keyboardPage.$$('#capsLockKey'));
keyboardParams['showExternalMetaKey'] = true; expectFalse(!!keyboardPage.$$('#externalMetaKey'));
cr.webUIListenerCallback('show-keys-changed', keyboardParams); expectFalse(!!keyboardPage.$$('#externalCommandKey'));
Polymer.dom.flush(); expectFalse(!!keyboardPage.$$('#assistantKey'));
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
expectTrue(!!keyboardPage.$$('#capsLockKey')); // Add a non-Apple external keyboard.
expectTrue(!!keyboardPage.$$('#externalMetaKey')); keyboardParams['showExternalMetaKey'] = true;
expectFalse(!!keyboardPage.$$('#externalCommandKey')); cr.webUIListenerCallback('show-keys-changed', keyboardParams);
expectFalse(!!keyboardPage.$$('#assistantKey')); Polymer.dom.flush();
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
// Add an Apple keyboard. expectTrue(!!keyboardPage.$$('#capsLockKey'));
keyboardParams['showAppleCommandKey'] = true; expectTrue(!!keyboardPage.$$('#externalMetaKey'));
cr.webUIListenerCallback('show-keys-changed', keyboardParams); expectFalse(!!keyboardPage.$$('#externalCommandKey'));
Polymer.dom.flush(); expectFalse(!!keyboardPage.$$('#assistantKey'));
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
expectTrue(!!keyboardPage.$$('#capsLockKey')); // Add an Apple keyboard.
expectTrue(!!keyboardPage.$$('#externalMetaKey')); keyboardParams['showAppleCommandKey'] = true;
expectTrue(!!keyboardPage.$$('#externalCommandKey')); cr.webUIListenerCallback('show-keys-changed', keyboardParams);
expectFalse(!!keyboardPage.$$('#assistantKey')); Polymer.dom.flush();
expectFalse(!!keyboardPage.$$('#internalSearchKey'));
// Add an internal keyboard. expectTrue(!!keyboardPage.$$('#capsLockKey'));
keyboardParams['hasInternalKeyboard'] = true; expectTrue(!!keyboardPage.$$('#externalMetaKey'));
cr.webUIListenerCallback('show-keys-changed', keyboardParams); expectTrue(!!keyboardPage.$$('#externalCommandKey'));
Polymer.dom.flush(); expectFalse(!!keyboardPage.$$('#assistantKey'));
expectTrue(!!keyboardPage.$$('#internalSearchKey'));
expectTrue(!!keyboardPage.$$('#capsLockKey')); // Add an internal keyboard.
expectTrue(!!keyboardPage.$$('#externalMetaKey')); keyboardParams['hasInternalKeyboard'] = true;
expectTrue(!!keyboardPage.$$('#externalCommandKey')); cr.webUIListenerCallback('show-keys-changed', keyboardParams);
expectFalse(!!keyboardPage.$$('#assistantKey')); Polymer.dom.flush();
expectTrue(!!keyboardPage.$$('#internalSearchKey'));
// Pretend an Assistant key is now available. expectTrue(!!keyboardPage.$$('#capsLockKey'));
keyboardParams['hasAssistantKey'] = true; expectTrue(!!keyboardPage.$$('#externalMetaKey'));
cr.webUIListenerCallback('show-keys-changed', keyboardParams); expectTrue(!!keyboardPage.$$('#externalCommandKey'));
Polymer.dom.flush(); expectFalse(!!keyboardPage.$$('#assistantKey'));
expectTrue(!!keyboardPage.$$('#internalSearchKey'));
expectTrue(!!keyboardPage.$$('#capsLockKey')); // Pretend an Assistant key is now available.
expectTrue(!!keyboardPage.$$('#externalMetaKey')); keyboardParams['hasAssistantKey'] = true;
expectTrue(!!keyboardPage.$$('#externalCommandKey')); cr.webUIListenerCallback('show-keys-changed', keyboardParams);
expectTrue(!!keyboardPage.$$('#assistantKey')); Polymer.dom.flush();
expectTrue(!!keyboardPage.$$('#internalSearchKey'));
const collapse = keyboardPage.$$('iron-collapse'); expectTrue(!!keyboardPage.$$('#capsLockKey'));
assertTrue(!!collapse); expectTrue(!!keyboardPage.$$('#externalMetaKey'));
expectTrue(collapse.opened); expectTrue(!!keyboardPage.$$('#externalCommandKey'));
expectTrue(!!keyboardPage.$$('#assistantKey'));
expectEquals(500, keyboardPage.$$('#delaySlider').pref.value);
expectEquals(500, keyboardPage.$$('#repeatRateSlider').pref.value); const collapse = keyboardPage.$$('iron-collapse');
assertTrue(!!collapse);
// Test interaction with the settings-slider's underlying cr-slider. expectTrue(collapse.opened);
MockInteractions.pressAndReleaseKeyOn(
keyboardPage.$$('#delaySlider').$$('cr-slider'), 37 /* left */, [], expectEquals(500, keyboardPage.$$('#delaySlider').pref.value);
'ArrowLeft'); expectEquals(500, keyboardPage.$$('#repeatRateSlider').pref.value);
MockInteractions.pressAndReleaseKeyOn(
keyboardPage.$$('#repeatRateSlider').$$('cr-slider'), 39, [], // Test interaction with the settings-slider's underlying cr-slider.
'ArrowRight'); MockInteractions.pressAndReleaseKeyOn(
expectEquals(1000, get('xkb_auto_repeat_delay_r2')); keyboardPage.$$('#delaySlider').$$('cr-slider'), 37 /* left */, [],
expectEquals(300, get('xkb_auto_repeat_interval_r2')); 'ArrowLeft');
MockInteractions.pressAndReleaseKeyOn(
// Test sliders change when prefs change. keyboardPage.$$('#repeatRateSlider').$$('cr-slider'), 39, [],
set('xkb_auto_repeat_delay_r2', 1500); 'ArrowRight');
await test_util.flushTasks(); expectEquals(1000, get('xkb_auto_repeat_delay_r2'));
expectEquals(1500, keyboardPage.$$('#delaySlider').pref.value); expectEquals(300, get('xkb_auto_repeat_interval_r2'));
set('xkb_auto_repeat_interval_r2', 2000);
await test_util.flushTasks(); // Test sliders change when prefs change.
expectEquals(2000, keyboardPage.$$('#repeatRateSlider').pref.value); set('xkb_auto_repeat_delay_r2', 1500);
await test_util.flushTasks();
// Test sliders round to nearest value when prefs change. expectEquals(1500, keyboardPage.$$('#delaySlider').pref.value);
set('xkb_auto_repeat_delay_r2', 600); set('xkb_auto_repeat_interval_r2', 2000);
await test_util.flushTasks(); await test_util.flushTasks();
expectEquals(500, keyboardPage.$$('#delaySlider').pref.value); expectEquals(2000, keyboardPage.$$('#repeatRateSlider').pref.value);
set('xkb_auto_repeat_interval_r2', 45);
await test_util.flushTasks(); // Test sliders round to nearest value when prefs change.
expectEquals(50, keyboardPage.$$('#repeatRateSlider').pref.value); set('xkb_auto_repeat_delay_r2', 600);
await test_util.flushTasks();
set('xkb_auto_repeat_enabled_r2', false); expectEquals(500, keyboardPage.$$('#delaySlider').pref.value);
expectFalse(collapse.opened); set('xkb_auto_repeat_interval_r2', 45);
await test_util.flushTasks();
// Test keyboard shortcut viewer button. expectEquals(50, keyboardPage.$$('#repeatRateSlider').pref.value);
keyboardPage.$$('#keyboardShortcutViewer').click();
expectEquals( set('xkb_auto_repeat_enabled_r2', false);
1, expectFalse(collapse.opened);
settings.DevicePageBrowserProxyImpl.getInstance()
.keyboardShortcutViewerShown_); // Test keyboard shortcut viewer button.
keyboardPage.$$('#keyboardShortcutViewer').click();
expectEquals(
1,
settings.DevicePageBrowserProxyImpl.getInstance()
.keyboardShortcutViewerShown_);
});
}); });
test(assert(TestNames.Display), function() { suite(assert(TestNames.Display), function() {
let displayPage; test('display tests', function() {
const browserProxy = settings.DevicePageBrowserProxyImpl.getInstance(); let displayPage;
return Promise const browserProxy = settings.DevicePageBrowserProxyImpl.getInstance();
.all([ return Promise
// Get the display sub-page. .all([
showAndGetDeviceSubpage('display', settings.routes.DISPLAY) // Get the display sub-page.
.then(function(page) { showAndGetDeviceSubpage('display', settings.routes.DISPLAY)
displayPage = page; .then(function(page) {
// Verify all the conditionals that get run during page load displayPage = page;
// before the display info has been populated. // Verify all the conditionals that get run during page load
expectEquals(undefined, displayPage.displays); // before the display info has been populated.
expectFalse( expectEquals(undefined, displayPage.displays);
displayPage.showMirror_(true, displayPage.displays)); expectFalse(
expectFalse( displayPage.showMirror_(true, displayPage.displays));
displayPage.showMirror_(false, displayPage.displays)); expectFalse(
expectFalse(displayPage.isMirrored_(displayPage.displays)); displayPage.showMirror_(false, displayPage.displays));
expectFalse(displayPage.showUnifiedDesktop_( expectFalse(displayPage.isMirrored_(displayPage.displays));
true, true, displayPage.displays)); expectFalse(displayPage.showUnifiedDesktop_(
expectFalse(displayPage.showUnifiedDesktop_( true, true, displayPage.displays));
false, false, displayPage.displays)); expectFalse(displayPage.showUnifiedDesktop_(
expectEquals( false, false, displayPage.displays));
displayPage.invalidDisplayId_, expectEquals(
browserProxy.lastHighlightedDisplayId_); displayPage.invalidDisplayId_,
}), browserProxy.lastHighlightedDisplayId_);
// Wait for the initial call to getInfo. }),
fakeSystemDisplay.getInfoCalled.promise, // Wait for the initial call to getInfo.
])
.then(function() {
// Add a display.
addDisplay(1);
fakeSystemDisplay.onDisplayChanged.callListeners();
return Promise.all([
fakeSystemDisplay.getInfoCalled.promise, fakeSystemDisplay.getInfoCalled.promise,
fakeSystemDisplay.getLayoutCalled.promise, ])
]); .then(function() {
}) // Add a display.
.then(function() { addDisplay(1);
// There should be a single display which should be primary and fakeSystemDisplay.onDisplayChanged.callListeners();
// selected. Mirroring should be disabled.
expectEquals(1, displayPage.displays.length); return Promise.all([
expectEquals( fakeSystemDisplay.getInfoCalled.promise,
displayPage.displays[0].id, displayPage.selectedDisplay.id); fakeSystemDisplay.getLayoutCalled.promise,
expectEquals( ]);
displayPage.displays[0].id, displayPage.primaryDisplayId); })
expectFalse(displayPage.showMirror_(false, displayPage.displays)); .then(function() {
expectFalse(displayPage.isMirrored_(displayPage.displays)); // There should be a single display which should be primary and
// selected. Mirroring should be disabled.
// Verify unified desktop only shown when enabled. expectEquals(1, displayPage.displays.length);
expectTrue(displayPage.showUnifiedDesktop_( expectEquals(
true, true, displayPage.displays)); displayPage.displays[0].id, displayPage.selectedDisplay.id);
expectFalse(displayPage.showUnifiedDesktop_( expectEquals(
false, false, displayPage.displays)); displayPage.displays[0].id, displayPage.primaryDisplayId);
expectFalse(displayPage.showMirror_(false, displayPage.displays));
// Sanity check the first display is internal. expectFalse(displayPage.isMirrored_(displayPage.displays));
expectTrue(displayPage.displays[0].isInternal);
// Verify unified desktop only shown when enabled.
// Ambient EQ only shown when enabled. expectTrue(displayPage.showUnifiedDesktop_(
expectTrue(displayPage.showAmbientColorSetting_( true, true, displayPage.displays));
true, displayPage.displays[0])); expectFalse(displayPage.showUnifiedDesktop_(
expectFalse(displayPage.showAmbientColorSetting_( false, false, displayPage.displays));
false, displayPage.displays[0]));
// Sanity check the first display is internal.
// Verify that the arrangement section is not shown. expectTrue(displayPage.displays[0].isInternal);
expectEquals(null, displayPage.$$('#arrangement-section'));
// Ambient EQ only shown when enabled.
// Add a second display. expectTrue(displayPage.showAmbientColorSetting_(
addDisplay(2); true, displayPage.displays[0]));
fakeSystemDisplay.onDisplayChanged.callListeners(); expectFalse(displayPage.showAmbientColorSetting_(
false, displayPage.displays[0]));
return Promise.all([
fakeSystemDisplay.getInfoCalled.promise, // Verify that the arrangement section is not shown.
fakeSystemDisplay.getLayoutCalled.promise, expectEquals(null, displayPage.$$('#arrangement-section'));
new Promise(function(resolve, reject) {
setTimeout(resolve); // Add a second display.
}) addDisplay(2);
]); fakeSystemDisplay.onDisplayChanged.callListeners();
})
.then(function() { return Promise.all([
// There should be two displays, the first should be primary and fakeSystemDisplay.getInfoCalled.promise,
// selected. Mirroring should be enabled but set to false. fakeSystemDisplay.getLayoutCalled.promise,
expectEquals(2, displayPage.displays.length); new Promise(function(resolve, reject) {
expectEquals( setTimeout(resolve);
displayPage.displays[0].id, displayPage.selectedDisplay.id); })
expectEquals( ]);
displayPage.displays[0].id, displayPage.primaryDisplayId); })
expectTrue(displayPage.showMirror_(false, displayPage.displays)); .then(function() {
expectFalse(displayPage.isMirrored_(displayPage.displays)); // There should be two displays, the first should be primary and
// selected. Mirroring should be enabled but set to false.
// Verify unified desktop only shown when enabled. expectEquals(2, displayPage.displays.length);
expectTrue(displayPage.showUnifiedDesktop_( expectEquals(
true, true, displayPage.displays)); displayPage.displays[0].id, displayPage.selectedDisplay.id);
expectFalse(displayPage.showUnifiedDesktop_( expectEquals(
false, false, displayPage.displays)); displayPage.displays[0].id, displayPage.primaryDisplayId);
expectTrue(displayPage.showMirror_(false, displayPage.displays));
// Sanity check the second display is not internal. expectFalse(displayPage.isMirrored_(displayPage.displays));
expectFalse(displayPage.displays[1].isInternal);
// Verify unified desktop only shown when enabled.
expectTrue(displayPage.showUnifiedDesktop_(
// Verify the display modes are parsed correctly. true, true, displayPage.displays));
expectFalse(displayPage.showUnifiedDesktop_(
// 5 total modes, 2 parent modes. false, false, displayPage.displays));
expectEquals(5, displayPage.modeToParentModeMap_.size);
expectEquals(0, displayPage.modeToParentModeMap_.get(0)); // Sanity check the second display is not internal.
expectEquals(0, displayPage.modeToParentModeMap_.get(1)); expectFalse(displayPage.displays[1].isInternal);
expectEquals(2, displayPage.modeToParentModeMap_.get(2));
expectEquals(2, displayPage.modeToParentModeMap_.get(3));
expectEquals(2, displayPage.modeToParentModeMap_.get(4)); // Verify the display modes are parsed correctly.
// Two resolution options, one for each parent mode. // 5 total modes, 2 parent modes.
expectEquals(2, displayPage.refreshRateList_.length); expectEquals(5, displayPage.modeToParentModeMap_.size);
expectEquals(0, displayPage.modeToParentModeMap_.get(0));
// Each parent mode has the correct number of refresh rates. expectEquals(0, displayPage.modeToParentModeMap_.get(1));
expectEquals(2, displayPage.parentModeToRefreshRateMap_.size); expectEquals(2, displayPage.modeToParentModeMap_.get(2));
expectEquals( expectEquals(2, displayPage.modeToParentModeMap_.get(3));
2, displayPage.parentModeToRefreshRateMap_.get(0).length); expectEquals(2, displayPage.modeToParentModeMap_.get(4));
expectEquals(
3, displayPage.parentModeToRefreshRateMap_.get(2).length); // Two resolution options, one for each parent mode.
expectEquals(2, displayPage.refreshRateList_.length);
// Ambient EQ never shown on non-internal display regardless of
// whether it is enabled. // Each parent mode has the correct number of refresh rates.
expectFalse(displayPage.showAmbientColorSetting_( expectEquals(2, displayPage.parentModeToRefreshRateMap_.size);
true, displayPage.displays[1])); expectEquals(
expectFalse(displayPage.showAmbientColorSetting_( 2, displayPage.parentModeToRefreshRateMap_.get(0).length);
false, displayPage.displays[1])); expectEquals(
3, displayPage.parentModeToRefreshRateMap_.get(2).length);
// Verify that the arrangement section is shown.
expectTrue(!!displayPage.$$('#arrangement-section')); // Ambient EQ never shown on non-internal display regardless of
// whether it is enabled.
// Select the second display and make it primary. Also change the expectFalse(displayPage.showAmbientColorSetting_(
// orientation of the second display. true, displayPage.displays[1]));
const displayLayout = displayPage.$$('#displayLayout'); expectFalse(displayPage.showAmbientColorSetting_(
assertTrue(!!displayLayout); false, displayPage.displays[1]));
const displayDiv = displayLayout.$$('#_fakeDisplayId2');
assertTrue(!!displayDiv); // Verify that the arrangement section is shown.
displayDiv.click(); expectTrue(!!displayPage.$$('#arrangement-section'));
expectEquals(
displayPage.displays[1].id, displayPage.selectedDisplay.id); // Select the second display and make it primary. Also change the
// orientation of the second display.
displayPage.updatePrimaryDisplay_({target: {value: '0'}}); const displayLayout = displayPage.$$('#displayLayout');
displayPage.onOrientationChange_({target: {value: '90'}}); assertTrue(!!displayLayout);
fakeSystemDisplay.onDisplayChanged.callListeners(); const displayDiv = displayLayout.$$('#_fakeDisplayId2');
assertTrue(!!displayDiv);
return Promise.all([ displayDiv.click();
fakeSystemDisplay.getInfoCalled.promise, expectEquals(
fakeSystemDisplay.getLayoutCalled.promise, displayPage.displays[1].id, displayPage.selectedDisplay.id);
new Promise(function(resolve, reject) {
setTimeout(resolve); displayPage.updatePrimaryDisplay_({target: {value: '0'}});
}) displayPage.onOrientationChange_({target: {value: '90'}});
]); fakeSystemDisplay.onDisplayChanged.callListeners();
})
.then(function() { return Promise.all([
// Confirm that the second display is selected, primary, and fakeSystemDisplay.getInfoCalled.promise,
// rotated. fakeSystemDisplay.getLayoutCalled.promise,
expectEquals(2, displayPage.displays.length); new Promise(function(resolve, reject) {
expectEquals( setTimeout(resolve);
displayPage.displays[1].id, displayPage.selectedDisplay.id); })
expectTrue(displayPage.displays[1].isPrimary); ]);
expectEquals( })
displayPage.displays[1].id, displayPage.primaryDisplayId); .then(function() {
expectEquals(90, displayPage.displays[1].rotation); // Confirm that the second display is selected, primary, and
// rotated.
// Mirror the displays. expectEquals(2, displayPage.displays.length);
displayPage.onMirroredTap_({target: {blur: function() {}}}); expectEquals(
fakeSystemDisplay.onDisplayChanged.callListeners(); displayPage.displays[1].id, displayPage.selectedDisplay.id);
expectTrue(displayPage.displays[1].isPrimary);
return Promise.all([ expectEquals(
fakeSystemDisplay.getInfoCalled.promise, displayPage.displays[1].id, displayPage.primaryDisplayId);
fakeSystemDisplay.getLayoutCalled.promise, expectEquals(90, displayPage.displays[1].rotation);
new Promise(function(resolve, reject) {
setTimeout(resolve); // Mirror the displays.
}) displayPage.onMirroredTap_({target: {blur: function() {}}});
]); fakeSystemDisplay.onDisplayChanged.callListeners();
})
.then(function() { return Promise.all([
// Confirm that there is now only one display and that it is primary fakeSystemDisplay.getInfoCalled.promise,
// and mirroring is enabled. fakeSystemDisplay.getLayoutCalled.promise,
expectEquals(1, displayPage.displays.length); new Promise(function(resolve, reject) {
expectEquals( setTimeout(resolve);
displayPage.displays[0].id, displayPage.selectedDisplay.id); })
expectTrue(displayPage.displays[0].isPrimary); ]);
expectTrue(displayPage.showMirror_(false, displayPage.displays)); })
expectTrue(displayPage.isMirrored_(displayPage.displays)); .then(function() {
// Confirm that there is now only one display and that it is
// Verify that the arrangement section is shown while mirroring. // primary and mirroring is enabled.
expectTrue(!!displayPage.$$('#arrangement-section')); expectEquals(1, displayPage.displays.length);
expectEquals(
// Ensure that the zoom value remains unchanged while draggging. displayPage.displays[0].id, displayPage.selectedDisplay.id);
function pointerEvent(eventType, ratio) { expectTrue(displayPage.displays[0].isPrimary);
const crSlider = displayPage.$.displaySizeSlider.$.slider; expectTrue(displayPage.showMirror_(false, displayPage.displays));
const rect = crSlider.$.container.getBoundingClientRect(); expectTrue(displayPage.isMirrored_(displayPage.displays));
crSlider.dispatchEvent(new PointerEvent(eventType, {
buttons: 1, // Verify that the arrangement section is shown while mirroring.
pointerId: 1, expectTrue(!!displayPage.$$('#arrangement-section'));
clientX: rect.left + (ratio * rect.width),
})); // Ensure that the zoom value remains unchanged while draggging.
} function pointerEvent(eventType, ratio) {
const crSlider = displayPage.$.displaySizeSlider.$.slider;
expectEquals(1, displayPage.selectedZoomPref_.value); const rect = crSlider.$.container.getBoundingClientRect();
pointerEvent('pointerdown', .6); crSlider.dispatchEvent(new PointerEvent(eventType, {
expectEquals(1, displayPage.selectedZoomPref_.value); buttons: 1,
pointerEvent('pointermove', .3); pointerId: 1,
expectEquals(1, displayPage.selectedZoomPref_.value); clientX: rect.left + (ratio * rect.width),
pointerEvent('pointerup', 0); }));
expectEquals(1.25, displayPage.selectedZoomPref_.value); }
// Navigate out of the display page. expectEquals(1, displayPage.selectedZoomPref_.value);
return showAndGetDeviceSubpage('power', settings.routes.POWER); pointerEvent('pointerdown', .6);
}) expectEquals(1, displayPage.selectedZoomPref_.value);
.then(function() { pointerEvent('pointermove', .3);
// Moving out of the display page should set selected display to expectEquals(1, displayPage.selectedZoomPref_.value);
// invalid. pointerEvent('pointerup', 0);
expectEquals( expectEquals(1.25, displayPage.selectedZoomPref_.value);
displayPage.invalidDisplayId_,
browserProxy.lastHighlightedDisplayId_); // Navigate out of the display page.
return showAndGetDeviceSubpage('power', settings.routes.POWER);
// Navigate back to the display page. })
return showAndGetDeviceSubpage('display', settings.routes.DISPLAY); .then(function() {
}); // Moving out of the display page should set selected display to
// invalid.
expectEquals(
displayPage.invalidDisplayId_,
browserProxy.lastHighlightedDisplayId_);
// Navigate back to the display page.
return showAndGetDeviceSubpage(
'display', settings.routes.DISPLAY);
});
});
}); });
test(assert(TestNames.NightLight), async function() { test(assert(TestNames.NightLight), async function() {
......
...@@ -502,7 +502,7 @@ TEST_F('OSSettingsAppManagementReducersTest', 'AllJsTests', () => { ...@@ -502,7 +502,7 @@ TEST_F('OSSettingsAppManagementReducersTest', 'AllJsTests', () => {
mocha.run(); mocha.run();
}); });
// Tests for the Device page. // Tests for the Bluetooth page.
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsBluetoothPageTest = class extends OSSettingsBrowserTest { var OSSettingsBluetoothPageTest = class extends OSSettingsBrowserTest {
/** @override */ /** @override */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment