| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/mus/root_window_controller.h" | |
| 6 | |
| 7 #include "ash/common/test/ash_test.h" | |
| 8 #include "ash/common/wm_shell.h" | |
| 9 #include "ash/common/wm_window.h" | |
| 10 #include "ash/mus/test/wm_test_base.h" | |
| 11 #include "ui/aura/window.h" | |
| 12 #include "ui/display/screen.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 int64_t GetDisplayId(aura::Window* window) { | |
| 19 return display::Screen::GetScreen()->GetDisplayNearestWindow(window).id(); | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 using RootWindowControllerTest = AshTest; | |
| 25 | |
| 26 TEST_F(RootWindowControllerTest, CreateFullscreenWindow) { | |
| 27 std::unique_ptr<WindowOwner> window_owner = CreateToplevelTestWindow(); | |
| 28 WmWindow* window = window_owner->window(); | |
| 29 window->SetFullscreen(); | |
| 30 WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow(); | |
| 31 EXPECT_EQ(root_window->GetBounds(), window->GetBounds()); | |
| 32 } | |
| 33 | |
| 34 using RootWindowControllerWmTest = mus::WmTestBase; | |
| 35 | |
| 36 TEST_F(RootWindowControllerWmTest, IsWindowShownInCorrectDisplay) { | |
| 37 if (!SupportsMultipleDisplays()) | |
| 38 return; | |
| 39 | |
| 40 UpdateDisplay("400x400,400x400"); | |
| 41 EXPECT_NE(GetPrimaryDisplay().id(), GetSecondaryDisplay().id()); | |
| 42 | |
| 43 std::unique_ptr<aura::Window> window_primary_display( | |
| 44 CreateFullscreenTestWindow(GetPrimaryDisplay().id())); | |
| 45 std::unique_ptr<aura::Window> window_secondary_display( | |
| 46 CreateFullscreenTestWindow(GetSecondaryDisplay().id())); | |
| 47 | |
| 48 EXPECT_EQ(GetPrimaryDisplay().id(), | |
| 49 GetDisplayId(window_primary_display.get())); | |
| 50 EXPECT_EQ(GetSecondaryDisplay().id(), | |
| 51 GetDisplayId(window_secondary_display.get())); | |
| 52 } | |
| 53 | |
| 54 } // namespace ash | |
| OLD | NEW |