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

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

Issue 72503002: Remove some pass-thrus on RootWindow API in favor of exposing the RootWindowHost again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/screen_position_controller.h" 5 #include "ash/display/screen_position_controller.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 DISALLOW_COPY_AND_ASSIGN(ScreenPositionControllerTest); 82 DISALLOW_COPY_AND_ASSIGN(ScreenPositionControllerTest);
83 }; 83 };
84 84
85 } // namespace 85 } // namespace
86 86
87 TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreen) { 87 TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreen) {
88 UpdateDisplay("100+100-200x200,100+500-200x200"); 88 UpdateDisplay("100+100-200x200,100+500-200x200");
89 89
90 aura::Window::Windows root_windows = 90 aura::Window::Windows root_windows =
91 Shell::GetInstance()->GetAllRootWindows(); 91 Shell::GetInstance()->GetAllRootWindows();
92 EXPECT_EQ("100,100", 92 EXPECT_EQ("100,100", root_windows[0]->GetDispatcher()->host()->
93 root_windows[0]->GetDispatcher()->GetHostOrigin().ToString()); 93 GetBounds().origin().ToString());
94 EXPECT_EQ("200x200", 94 EXPECT_EQ("200x200", root_windows[0]->GetDispatcher()->host()->
95 root_windows[0]->GetDispatcher()->GetHostSize().ToString()); 95 GetBounds().size().ToString());
96 EXPECT_EQ("100,500", 96 EXPECT_EQ("100,500", root_windows[1]->GetDispatcher()->host()->
97 root_windows[1]->GetDispatcher()->GetHostOrigin().ToString()); 97 GetBounds().origin().ToString());
98 EXPECT_EQ("200x200", 98 EXPECT_EQ("200x200", root_windows[1]->GetDispatcher()->host()->
99 root_windows[1]->GetDispatcher()->GetHostSize().ToString()); 99 GetBounds().size().ToString());
100 100
101 const gfx::Point window_pos(100, 100); 101 const gfx::Point window_pos(100, 100);
102 window_->SetBoundsInScreen( 102 window_->SetBoundsInScreen(
103 gfx::Rect(window_pos, gfx::Size(100, 100)), 103 gfx::Rect(window_pos, gfx::Size(100, 100)),
104 Shell::GetScreen()->GetDisplayNearestPoint(window_pos)); 104 Shell::GetScreen()->GetDisplayNearestPoint(window_pos));
105 SetSecondaryDisplayLayout(DisplayLayout::RIGHT); 105 SetSecondaryDisplayLayout(DisplayLayout::RIGHT);
106 // The point is on the primary root window. 106 // The point is on the primary root window.
107 EXPECT_EQ("50,50", ConvertHostPointToScreen(50, 50)); 107 EXPECT_EQ("50,50", ConvertHostPointToScreen(50, 50));
108 // The point is out of the all root windows. 108 // The point is out of the all root windows.
109 EXPECT_EQ("250,250", ConvertHostPointToScreen(250, 250)); 109 EXPECT_EQ("250,250", ConvertHostPointToScreen(250, 250));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // The point is on the primary root window. 171 // The point is on the primary root window.
172 EXPECT_EQ("50,0", ConvertHostPointToScreen(50, -400)); 172 EXPECT_EQ("50,0", ConvertHostPointToScreen(50, -400));
173 } 173 }
174 174
175 TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenHiDPI) { 175 TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenHiDPI) {
176 UpdateDisplay("100+100-200x200*2,100+500-200x200"); 176 UpdateDisplay("100+100-200x200*2,100+500-200x200");
177 177
178 aura::Window::Windows root_windows = 178 aura::Window::Windows root_windows =
179 Shell::GetInstance()->GetAllRootWindows(); 179 Shell::GetInstance()->GetAllRootWindows();
180 EXPECT_EQ("100,100", 180 EXPECT_EQ("100,100",
181 root_windows[0]->GetDispatcher()->GetHostOrigin().ToString()); 181 root_windows[0]->GetDispatcher()->host()->
182 GetBounds().origin().ToString());
182 EXPECT_EQ("200x200", 183 EXPECT_EQ("200x200",
183 root_windows[0]->GetDispatcher()->GetHostSize().ToString()); 184 root_windows[0]->GetDispatcher()->host()->
185 GetBounds().size().ToString());
184 EXPECT_EQ("100,500", 186 EXPECT_EQ("100,500",
185 root_windows[1]->GetDispatcher()->GetHostOrigin().ToString()); 187 root_windows[1]->GetDispatcher()->host()->
188 GetBounds().origin().ToString());
186 EXPECT_EQ("200x200", 189 EXPECT_EQ("200x200",
187 root_windows[1]->GetDispatcher()->GetHostSize().ToString()); 190 root_windows[1]->GetDispatcher()->host()->
191 GetBounds().size().ToString());
188 192
189 // Put |window_| to the primary 2x display. 193 // Put |window_| to the primary 2x display.
190 window_->SetBoundsInScreen(gfx::Rect(20, 20, 50, 50), 194 window_->SetBoundsInScreen(gfx::Rect(20, 20, 50, 50),
191 Shell::GetScreen()->GetPrimaryDisplay()); 195 Shell::GetScreen()->GetPrimaryDisplay());
192 // (30, 30) means the host coordinate, so the point is still on the primary 196 // (30, 30) means the host coordinate, so the point is still on the primary
193 // root window. Since it's 2x, the specified native point was halved. 197 // root window. Since it's 2x, the specified native point was halved.
194 EXPECT_EQ("15,15", ConvertHostPointToScreen(30, 30)); 198 EXPECT_EQ("15,15", ConvertHostPointToScreen(30, 30));
195 // Similar to above but the point is out of the all root windows. 199 // Similar to above but the point is out of the all root windows.
196 EXPECT_EQ("200,200", ConvertHostPointToScreen(400, 400)); 200 EXPECT_EQ("200,200", ConvertHostPointToScreen(400, 400));
197 // Similar to above but the point is on the secondary display. 201 // Similar to above but the point is on the secondary display.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 EXPECT_EQ("210,70", ConvertHostPointToScreen(60, 70)); 271 EXPECT_EQ("210,70", ConvertHostPointToScreen(60, 70));
268 // The point is out of the host windows. 272 // The point is out of the host windows.
269 EXPECT_EQ("210,-50", ConvertHostPointToScreen(60, -50)); 273 EXPECT_EQ("210,-50", ConvertHostPointToScreen(60, -50));
270 // The point is on the 2nd host. Point on 1nd host (60, 60) 274 // The point is on the 2nd host. Point on 1nd host (60, 60)
271 // 1/2 * 1.5 = (45,45) 275 // 1/2 * 1.5 = (45,45)
272 EXPECT_EQ("45,45", ConvertHostPointToScreen(60, -340)); 276 EXPECT_EQ("45,45", ConvertHostPointToScreen(60, -340));
273 } 277 }
274 278
275 } // namespace test 279 } // namespace test
276 } // namespace ash 280 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_position_controller.cc ('k') | ash/display/virtual_keyboard_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698