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