Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: ash/mus/root_window_controller_unittest.cc

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: feedback2 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 5 #include "ash/mus/root_window_controller.h"
6 6
7 #include "ash/common/test/ash_test.h" 7 #include "ash/common/test/ash_test.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/mus/test/wm_test_base.h" 10 #include "ash/mus/test/wm_test_base.h"
11 #include "ui/aura/window.h"
12 #include "ui/display/screen.h"
11 13
12 namespace ash { 14 namespace ash {
13 15
16 namespace {
17
18 int64_t GetDisplayId(aura::Window* window) {
19 return display::Screen::GetScreen()->GetDisplayNearestWindow(window).id();
20 }
21
22 } // namespace
23
14 using RootWindowControllerTest = AshTest; 24 using RootWindowControllerTest = AshTest;
15 25
16 TEST_F(RootWindowControllerTest, CreateFullscreenWindow) { 26 TEST_F(RootWindowControllerTest, CreateFullscreenWindow) {
17 std::unique_ptr<WindowOwner> window_owner = CreateToplevelTestWindow(); 27 std::unique_ptr<WindowOwner> window_owner = CreateToplevelTestWindow();
18 WmWindow* window = window_owner->window(); 28 WmWindow* window = window_owner->window();
19 window->SetFullscreen(); 29 window->SetFullscreen();
20 WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow(); 30 WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow();
21 EXPECT_EQ(root_window->GetBounds(), window->GetBounds()); 31 EXPECT_EQ(root_window->GetBounds(), window->GetBounds());
22 } 32 }
23 33
24 using RootWindowControllerWmTest = mus::WmTestBase; 34 using RootWindowControllerWmTest = mus::WmTestBase;
25 35
26 TEST_F(RootWindowControllerWmTest, IsWindowShownInCorrectDisplay) { 36 TEST_F(RootWindowControllerWmTest, IsWindowShownInCorrectDisplay) {
27 if (!SupportsMultipleDisplays()) 37 if (!SupportsMultipleDisplays())
28 return; 38 return;
29 39
30 UpdateDisplay("400x400,400x400"); 40 UpdateDisplay("400x400,400x400");
31 EXPECT_NE(GetPrimaryDisplay().id(), GetSecondaryDisplay().id()); 41 EXPECT_NE(GetPrimaryDisplay().id(), GetSecondaryDisplay().id());
32 42
33 ui::Window* window_primary_display = 43 std::unique_ptr<aura::Window> window_primary_display(
34 CreateFullscreenTestWindow(GetPrimaryDisplay().id()); 44 CreateFullscreenTestWindow(GetPrimaryDisplay().id()));
35 ui::Window* window_secondary_display = 45 std::unique_ptr<aura::Window> window_secondary_display(
36 CreateFullscreenTestWindow(GetSecondaryDisplay().id()); 46 CreateFullscreenTestWindow(GetSecondaryDisplay().id()));
37 47
38 DCHECK(window_primary_display); 48 EXPECT_EQ(GetPrimaryDisplay().id(),
39 DCHECK(window_secondary_display); 49 GetDisplayId(window_primary_display.get()));
40 50 EXPECT_EQ(GetSecondaryDisplay().id(),
41 EXPECT_EQ(window_primary_display->display_id(), GetPrimaryDisplay().id()); 51 GetDisplayId(window_secondary_display.get()));
42 EXPECT_EQ(window_secondary_display->display_id(), GetSecondaryDisplay().id());
43 } 52 }
44 53
45 } // namespace ash 54 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698