blob: b3a65f1a3e063bbaa7cb2e232c96269fea2cfc86 [file] [log] [blame]
James Cook40f7d752018-05-25 18:21:581// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/shell_state.h"
6
7#include <stdint.h>
8
James Cook40f7d752018-05-25 18:21:589#include "ash/scoped_root_window_for_new_windows.h"
10#include "ash/shell.h"
11#include "ash/test/ash_test_base.h"
James Cook7363ebc2018-08-10 21:17:2412#include "ui/display/display.h"
James Cook40f7d752018-05-25 18:21:5813#include "ui/display/manager/display_manager.h"
James Cook7363ebc2018-08-10 21:17:2414#include "ui/display/screen.h"
James Cook40f7d752018-05-25 18:21:5815
16namespace ash {
17namespace {
18
James Cook40f7d752018-05-25 18:21:5819using ShellStateTest = AshTestBase;
20
James Cook7363ebc2018-08-10 21:17:2421TEST_F(ShellStateTest, GetDisplayForNewWindows) {
James Cook40f7d752018-05-25 18:21:5822 UpdateDisplay("1024x768,800x600");
23 const int64_t primary_display_id = display_manager()->GetDisplayAt(0).id();
24 const int64_t secondary_display_id = display_manager()->GetDisplayAt(1).id();
25
James Cook7363ebc2018-08-10 21:17:2426 display::Screen* screen = display::Screen::GetScreen();
27 EXPECT_EQ(primary_display_id, screen->GetDisplayForNewWindows().id());
James Cook40f7d752018-05-25 18:21:5828
29 // Setting a root window for new windows notifies the client.
30 ScopedRootWindowForNewWindows scoped_root(Shell::GetAllRootWindows()[1]);
James Cook7363ebc2018-08-10 21:17:2431 EXPECT_EQ(secondary_display_id, screen->GetDisplayForNewWindows().id());
James Cook40f7d752018-05-25 18:21:5832}
33
34} // namespace
35} // namespace ash