Commit 8d0ea12d authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[DevicePage] Refactor Display page test to use setup

Refactor Display page test to use setup so that further tests could be
added to test deep linking.

Bug: 1084154
Change-Id: I343710d7ffb5d82b17c3288fa46b69f0069cfc5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2373386
Commit-Queue: Daniel Classon <dclasson@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801208}
parent e8fbb9f2
...@@ -821,44 +821,40 @@ cr.define('device_page_tests', function() { ...@@ -821,44 +821,40 @@ cr.define('device_page_tests', function() {
}); });
suite(assert(TestNames.Display), function() { suite(assert(TestNames.Display), function() {
let displayPage;
let browserProxy;
setup(async () => {
displayPage =
await showAndGetDeviceSubpage('display', settings.routes.DISPLAY);
browserProxy = settings.DevicePageBrowserProxyImpl.getInstance();
await fakeSystemDisplay.getInfoCalled.promise;
});
test('display tests', function() { test('display tests', function() {
let displayPage; // Verify all the conditionals that get run during page load
const browserProxy = settings.DevicePageBrowserProxyImpl.getInstance(); // before the display info has been populated.
expectEquals(undefined, displayPage.displays);
expectFalse(displayPage.showMirror_(true, displayPage.displays));
expectFalse(displayPage.showMirror_(false, displayPage.displays));
expectFalse(displayPage.isMirrored_(displayPage.displays));
expectFalse(
displayPage.showUnifiedDesktop_(true, true, displayPage.displays));
expectFalse(displayPage.showUnifiedDesktop_(
false, false, displayPage.displays));
expectEquals(
displayPage.invalidDisplayId_,
browserProxy.lastHighlightedDisplayId_);
// Add a display.
addDisplay(1);
fakeSystemDisplay.onDisplayChanged.callListeners();
return Promise return Promise
.all([ .all([
// Get the display sub-page.
showAndGetDeviceSubpage('display', settings.routes.DISPLAY)
.then(function(page) {
displayPage = page;
// Verify all the conditionals that get run during page load
// before the display info has been populated.
expectEquals(undefined, displayPage.displays);
expectFalse(
displayPage.showMirror_(true, displayPage.displays));
expectFalse(
displayPage.showMirror_(false, displayPage.displays));
expectFalse(displayPage.isMirrored_(displayPage.displays));
expectFalse(displayPage.showUnifiedDesktop_(
true, true, displayPage.displays));
expectFalse(displayPage.showUnifiedDesktop_(
false, false, displayPage.displays));
expectEquals(
displayPage.invalidDisplayId_,
browserProxy.lastHighlightedDisplayId_);
}),
// Wait for the initial call to getInfo.
fakeSystemDisplay.getInfoCalled.promise, fakeSystemDisplay.getInfoCalled.promise,
fakeSystemDisplay.getLayoutCalled.promise,
]) ])
.then(function() {
// Add a display.
addDisplay(1);
fakeSystemDisplay.onDisplayChanged.callListeners();
return Promise.all([
fakeSystemDisplay.getInfoCalled.promise,
fakeSystemDisplay.getLayoutCalled.promise,
]);
})
.then(function() { .then(function() {
// There should be a single display which should be primary and // There should be a single display which should be primary and
// selected. Mirroring should be disabled. // selected. Mirroring should be disabled.
......
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