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 #include "ash/display/multi_display_manager.h" | 6 #include "ash/display/multi_display_manager.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/wm/window_cycle_controller.h" | 9 #include "ash/wm/window_cycle_controller.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 controller->HandleCycleWindow(WindowCycleController::BACKWARD, false); | 209 controller->HandleCycleWindow(WindowCycleController::BACKWARD, false); |
210 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); | 210 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); |
211 | 211 |
212 // Cycle through all windows across root windows. | 212 // Cycle through all windows across root windows. |
213 views::Widget* d1_w2 = CreateTestWidget(gfx::Rect(10, 200, 100, 100)); | 213 views::Widget* d1_w2 = CreateTestWidget(gfx::Rect(10, 200, 100, 100)); |
214 EXPECT_EQ(root_windows[0], d1_w2->GetNativeView()->GetRootWindow()); | 214 EXPECT_EQ(root_windows[0], d1_w2->GetNativeView()->GetRootWindow()); |
215 views::Widget* d2_w2 = CreateTestWidget(gfx::Rect(800, 200, 100, 100)); | 215 views::Widget* d2_w2 = CreateTestWidget(gfx::Rect(800, 200, 100, 100)); |
216 EXPECT_EQ(root_windows[1], d2_w2->GetNativeView()->GetRootWindow()); | 216 EXPECT_EQ(root_windows[1], d2_w2->GetNativeView()->GetRootWindow()); |
217 | 217 |
218 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); | 218 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); |
| 219 EXPECT_TRUE(wm::IsActiveWindow(d1_w2->GetNativeView())); |
| 220 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); |
219 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); | 221 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); |
220 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); | 222 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); |
221 EXPECT_TRUE(wm::IsActiveWindow(d1_w2->GetNativeView())); | |
222 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); | |
223 EXPECT_TRUE(wm::IsActiveWindow(d1_w1->GetNativeView())); | 223 EXPECT_TRUE(wm::IsActiveWindow(d1_w1->GetNativeView())); |
224 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); | 224 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); |
225 EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView())); | 225 EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView())); |
226 | 226 |
227 // Backwards | 227 // Backwards |
228 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); | 228 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); |
229 EXPECT_TRUE(wm::IsActiveWindow(d1_w1->GetNativeView())); | 229 EXPECT_TRUE(wm::IsActiveWindow(d1_w1->GetNativeView())); |
230 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); | 230 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); |
| 231 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); |
| 232 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); |
231 EXPECT_TRUE(wm::IsActiveWindow(d1_w2->GetNativeView())); | 233 EXPECT_TRUE(wm::IsActiveWindow(d1_w2->GetNativeView())); |
232 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); | 234 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); |
233 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); | |
234 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); | |
235 EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView())); | 235 EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView())); |
236 } | 236 } |
237 | 237 |
238 TEST_F(ExtendedDesktopTest, GetRootWindowAt) { | 238 TEST_F(ExtendedDesktopTest, GetRootWindowAt) { |
239 UpdateDisplay("700x500,500x500"); | 239 UpdateDisplay("700x500,500x500"); |
240 Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout( | 240 Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout( |
241 internal::DisplayController::LEFT); | 241 internal::DisplayController::LEFT); |
242 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 242 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
243 | 243 |
244 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(-400, 100))); | 244 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(-400, 100))); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 p.SetPoint(0, 0); | 488 p.SetPoint(0, 0); |
489 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); | 489 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); |
490 EXPECT_EQ("0,-600", p.ToString()); | 490 EXPECT_EQ("0,-600", p.ToString()); |
491 p.SetPoint(0, 0); | 491 p.SetPoint(0, 0); |
492 aura::Window::ConvertPointToWindow(d1, d2, &p); | 492 aura::Window::ConvertPointToWindow(d1, d2, &p); |
493 EXPECT_EQ("-10,-610", p.ToString()); | 493 EXPECT_EQ("-10,-610", p.ToString()); |
494 } | 494 } |
495 | 495 |
496 } // namespace internal | 496 } // namespace internal |
497 } // namespace ash | 497 } // namespace ash |
OLD | NEW |