OLD | NEW |
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/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 DisplayLayout secondary_layout(DisplayLayout::RIGHT, 50); | 198 DisplayLayout secondary_layout(DisplayLayout::RIGHT, 50); |
199 display_controller->SetLayoutForDisplayName(secondary_name, secondary_layout); | 199 display_controller->SetLayoutForDisplayName(secondary_name, secondary_layout); |
200 | 200 |
201 EXPECT_NE(primary_display.id(), secondary_display.id()); | 201 EXPECT_NE(primary_display.id(), secondary_display.id()); |
202 aura::RootWindow* primary_root = | 202 aura::RootWindow* primary_root = |
203 display_controller->GetRootWindowForDisplayId(primary_display.id()); | 203 display_controller->GetRootWindowForDisplayId(primary_display.id()); |
204 aura::RootWindow* secondary_root = | 204 aura::RootWindow* secondary_root = |
205 display_controller->GetRootWindowForDisplayId(secondary_display.id()); | 205 display_controller->GetRootWindowForDisplayId(secondary_display.id()); |
206 EXPECT_NE(primary_root, secondary_root); | 206 EXPECT_NE(primary_root, secondary_root); |
207 aura::Window* launcher_window = | 207 aura::Window* launcher_window = |
208 Shell::GetInstance()->launcher()->widget()->GetNativeView(); | 208 Launcher::ForPrimaryDisplay()->widget()->GetNativeView(); |
209 EXPECT_TRUE(primary_root->Contains(launcher_window)); | 209 EXPECT_TRUE(primary_root->Contains(launcher_window)); |
210 EXPECT_FALSE(secondary_root->Contains(launcher_window)); | 210 EXPECT_FALSE(secondary_root->Contains(launcher_window)); |
211 EXPECT_EQ(primary_display.id(), | 211 EXPECT_EQ(primary_display.id(), |
212 Shell::GetScreen()->GetDisplayNearestPoint( | 212 Shell::GetScreen()->GetDisplayNearestPoint( |
213 gfx::Point(-100, -100)).id()); | 213 gfx::Point(-100, -100)).id()); |
214 EXPECT_EQ(primary_display.id(), | 214 EXPECT_EQ(primary_display.id(), |
215 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); | 215 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); |
216 | 216 |
217 // Switch primary and secondary | 217 // Switch primary and secondary |
218 display_controller->SetPrimaryDisplay(secondary_display); | 218 display_controller->SetPrimaryDisplay(secondary_display); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 display_manager()->GetDisplayNameFor(secondary_display); | 270 display_manager()->GetDisplayNameFor(secondary_display); |
271 DisplayLayout secondary_layout(DisplayLayout::RIGHT, 50); | 271 DisplayLayout secondary_layout(DisplayLayout::RIGHT, 50); |
272 display_controller->SetLayoutForDisplayName(secondary_name, secondary_layout); | 272 display_controller->SetLayoutForDisplayName(secondary_name, secondary_layout); |
273 | 273 |
274 EXPECT_NE(primary_display.id(), secondary_display.id()); | 274 EXPECT_NE(primary_display.id(), secondary_display.id()); |
275 aura::RootWindow* primary_root = | 275 aura::RootWindow* primary_root = |
276 display_controller->GetRootWindowForDisplayId(primary_display.id()); | 276 display_controller->GetRootWindowForDisplayId(primary_display.id()); |
277 aura::RootWindow* secondary_root = | 277 aura::RootWindow* secondary_root = |
278 display_controller->GetRootWindowForDisplayId(secondary_display.id()); | 278 display_controller->GetRootWindowForDisplayId(secondary_display.id()); |
279 aura::Window* launcher_window = | 279 aura::Window* launcher_window = |
280 Shell::GetInstance()->launcher()->widget()->GetNativeView(); | 280 Launcher::ForPrimaryDisplay()->widget()->GetNativeView(); |
281 EXPECT_TRUE(primary_root->Contains(launcher_window)); | 281 EXPECT_TRUE(primary_root->Contains(launcher_window)); |
282 EXPECT_FALSE(secondary_root->Contains(launcher_window)); | 282 EXPECT_FALSE(secondary_root->Contains(launcher_window)); |
283 EXPECT_NE(primary_root, secondary_root); | 283 EXPECT_NE(primary_root, secondary_root); |
284 EXPECT_EQ(primary_display.id(), | 284 EXPECT_EQ(primary_display.id(), |
285 Shell::GetScreen()->GetDisplayNearestPoint( | 285 Shell::GetScreen()->GetDisplayNearestPoint( |
286 gfx::Point(-100, -100)).id()); | 286 gfx::Point(-100, -100)).id()); |
287 EXPECT_EQ(primary_display.id(), | 287 EXPECT_EQ(primary_display.id(), |
288 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); | 288 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); |
289 | 289 |
290 // Switch primary and secondary by display ID. | 290 // Switch primary and secondary by display ID. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 UpdateDisplay("100+200-100x200,300+500-200x300"); | 404 UpdateDisplay("100+200-100x200,300+500-200x300"); |
405 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); | 405 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); |
406 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); | 406 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); |
407 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); | 407 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); |
408 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); | 408 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); |
409 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); | 409 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); |
410 } | 410 } |
411 | 411 |
412 } // namespace test | 412 } // namespace test |
413 } // namespace ash | 413 } // namespace ash |
OLD | NEW |