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

Side by Side Diff: ash/display/display_util_unittest.cc

Issue 2911393002: Nix GetRootWindowController, use RootWindowController::ForWindow. (Closed)
Patch Set: Sync and rebase AGAIN Created 3 years, 6 months 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
« no previous file with comments | « ash/display/cursor_window_controller.cc ('k') | ash/display/extended_mouse_warp_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/display/display_util.h" 5 #include "ash/display/display_util.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 10
11 namespace ash { 11 namespace ash {
12 12
13 typedef test::AshTestBase DisplayUtilTest; 13 typedef test::AshTestBase DisplayUtilTest;
14 14
15 TEST_F(DisplayUtilTest, RotatedDisplay) { 15 TEST_F(DisplayUtilTest, RotatedDisplay) {
16 { 16 {
17 UpdateDisplay("10+10-500x400,600+10-1000x600/r"); 17 UpdateDisplay("10+10-500x400,600+10-1000x600/r");
18 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 18 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
19 AshWindowTreeHost* host0 = 19 AshWindowTreeHost* host0 =
20 GetRootWindowController(root_windows[0])->ash_host(); 20 RootWindowController::ForWindow(root_windows[0])->ash_host();
21 AshWindowTreeHost* host1 = 21 AshWindowTreeHost* host1 =
22 GetRootWindowController(root_windows[1])->ash_host(); 22 RootWindowController::ForWindow(root_windows[1])->ash_host();
23 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); 23 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300));
24 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); 24 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300));
25 EXPECT_EQ("509,20 1x300", rect0.ToString()); 25 EXPECT_EQ("509,20 1x300", rect0.ToString());
26 EXPECT_EQ("1289,10 300x1", rect1.ToString()); 26 EXPECT_EQ("1289,10 300x1", rect1.ToString());
27 } 27 }
28 { 28 {
29 UpdateDisplay("10+10-500x400,600+10-1000x600/l"); 29 UpdateDisplay("10+10-500x400,600+10-1000x600/l");
30 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 30 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
31 AshWindowTreeHost* host0 = 31 AshWindowTreeHost* host0 =
32 GetRootWindowController(root_windows[0])->ash_host(); 32 RootWindowController::ForWindow(root_windows[0])->ash_host();
33 AshWindowTreeHost* host1 = 33 AshWindowTreeHost* host1 =
34 GetRootWindowController(root_windows[1])->ash_host(); 34 RootWindowController::ForWindow(root_windows[1])->ash_host();
35 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); 35 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300));
36 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); 36 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300));
37 EXPECT_EQ("509,20 1x300", rect0.ToString()); 37 EXPECT_EQ("509,20 1x300", rect0.ToString());
38 EXPECT_EQ("610,609 300x1", rect1.ToString()); 38 EXPECT_EQ("610,609 300x1", rect1.ToString());
39 } 39 }
40 { 40 {
41 UpdateDisplay("10+10-500x400,600+10-1000x600/u"); 41 UpdateDisplay("10+10-500x400,600+10-1000x600/u");
42 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 42 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
43 AshWindowTreeHost* host0 = 43 AshWindowTreeHost* host0 =
44 GetRootWindowController(root_windows[0])->ash_host(); 44 RootWindowController::ForWindow(root_windows[0])->ash_host();
45 AshWindowTreeHost* host1 = 45 AshWindowTreeHost* host1 =
46 GetRootWindowController(root_windows[1])->ash_host(); 46 RootWindowController::ForWindow(root_windows[1])->ash_host();
47 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); 47 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300));
48 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); 48 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300));
49 EXPECT_EQ("509,20 1x300", rect0.ToString()); 49 EXPECT_EQ("509,20 1x300", rect0.ToString());
50 EXPECT_EQ("1599,299 1x300", rect1.ToString()); 50 EXPECT_EQ("1599,299 1x300", rect1.ToString());
51 } 51 }
52 52
53 { 53 {
54 UpdateDisplay("10+10-500x400/r,600+10-1000x600"); 54 UpdateDisplay("10+10-500x400/r,600+10-1000x600");
55 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 55 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
56 AshWindowTreeHost* host0 = 56 AshWindowTreeHost* host0 =
57 GetRootWindowController(root_windows[0])->ash_host(); 57 RootWindowController::ForWindow(root_windows[0])->ash_host();
58 AshWindowTreeHost* host1 = 58 AshWindowTreeHost* host1 =
59 GetRootWindowController(root_windows[1])->ash_host(); 59 RootWindowController::ForWindow(root_windows[1])->ash_host();
60 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(399, 10, 1, 300)); 60 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(399, 10, 1, 300));
61 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(400, 10, 1, 300)); 61 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(400, 10, 1, 300));
62 EXPECT_EQ("199,409 300x1", rect0.ToString()); 62 EXPECT_EQ("199,409 300x1", rect0.ToString());
63 EXPECT_EQ("600,20 1x300", rect1.ToString()); 63 EXPECT_EQ("600,20 1x300", rect1.ToString());
64 } 64 }
65 { 65 {
66 UpdateDisplay("10+10-500x400/l,600+10-1000x600"); 66 UpdateDisplay("10+10-500x400/l,600+10-1000x600");
67 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 67 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
68 AshWindowTreeHost* host0 = 68 AshWindowTreeHost* host0 =
69 GetRootWindowController(root_windows[0])->ash_host(); 69 RootWindowController::ForWindow(root_windows[0])->ash_host();
70 AshWindowTreeHost* host1 = 70 AshWindowTreeHost* host1 =
71 GetRootWindowController(root_windows[1])->ash_host(); 71 RootWindowController::ForWindow(root_windows[1])->ash_host();
72 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); 72 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300));
73 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); 73 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300));
74 EXPECT_EQ("20,10 300x1", rect0.ToString()); 74 EXPECT_EQ("20,10 300x1", rect0.ToString());
75 EXPECT_EQ("600,20 1x300", rect1.ToString()); 75 EXPECT_EQ("600,20 1x300", rect1.ToString());
76 } 76 }
77 { 77 {
78 UpdateDisplay("10+10-500x400/u,600+10-1000x600"); 78 UpdateDisplay("10+10-500x400/u,600+10-1000x600");
79 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 79 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
80 AshWindowTreeHost* host0 = 80 AshWindowTreeHost* host0 =
81 GetRootWindowController(root_windows[0])->ash_host(); 81 RootWindowController::ForWindow(root_windows[0])->ash_host();
82 AshWindowTreeHost* host1 = 82 AshWindowTreeHost* host1 =
83 GetRootWindowController(root_windows[1])->ash_host(); 83 RootWindowController::ForWindow(root_windows[1])->ash_host();
84 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); 84 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300));
85 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); 85 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300));
86 EXPECT_EQ("10,99 1x300", rect0.ToString()); 86 EXPECT_EQ("10,99 1x300", rect0.ToString());
87 EXPECT_EQ("600,20 1x300", rect1.ToString()); 87 EXPECT_EQ("600,20 1x300", rect1.ToString());
88 } 88 }
89 } 89 }
90 90
91 } // namespace ash 91 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/cursor_window_controller.cc ('k') | ash/display/extended_mouse_warp_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698