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