| OLD | NEW |
| 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 "athena/wm/split_view_controller.h" | 5 #include "athena/wm/split_view_controller.h" |
| 6 | 6 |
| 7 #include "athena/screen/public/screen_manager.h" | 7 #include "athena/screen/public/screen_manager.h" |
| 8 #include "athena/test/athena_test_base.h" | 8 #include "athena/test/athena_test_base.h" |
| 9 #include "athena/wm/public/window_list_provider.h" | 9 #include "athena/wm/public/window_list_provider.h" |
| 10 #include "athena/wm/test/window_manager_impl_test_api.h" | 10 #include "athena/wm/test/window_manager_impl_test_api.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 controller->ActivateSplitMode(windows[kNumWindows - 1], NULL); | 76 controller->ActivateSplitMode(windows[kNumWindows - 1], NULL); |
| 77 EXPECT_EQ(windows[kNumWindows - 1], controller->left_window()); | 77 EXPECT_EQ(windows[kNumWindows - 1], controller->left_window()); |
| 78 EXPECT_EQ(windows[kNumWindows - 2], controller->right_window()); | 78 EXPECT_EQ(windows[kNumWindows - 2], controller->right_window()); |
| 79 | 79 |
| 80 // Select one of the windows behind the stacks for the right panel. The window | 80 // Select one of the windows behind the stacks for the right panel. The window |
| 81 // on the left should remain unchanged. | 81 // on the left should remain unchanged. |
| 82 controller->ActivateSplitMode(NULL, windows[0]); | 82 controller->ActivateSplitMode(NULL, windows[0]); |
| 83 EXPECT_EQ(windows[kNumWindows - 1], controller->left_window()); | 83 EXPECT_EQ(windows[kNumWindows - 1], controller->left_window()); |
| 84 EXPECT_EQ(windows[0], controller->right_window()); | 84 EXPECT_EQ(windows[0], controller->right_window()); |
| 85 EXPECT_EQ(windows[0], *list_provider->GetWindowList().rbegin()); | 85 EXPECT_EQ(windows[0], *list_provider->GetCurrentWindowList().rbegin()); |
| 86 | 86 |
| 87 controller->ActivateSplitMode(windows[1], NULL); | 87 controller->ActivateSplitMode(windows[1], NULL); |
| 88 EXPECT_EQ(windows[1], controller->left_window()); | 88 EXPECT_EQ(windows[1], controller->left_window()); |
| 89 EXPECT_EQ(windows[0], controller->right_window()); | 89 EXPECT_EQ(windows[0], controller->right_window()); |
| 90 EXPECT_EQ(windows[1], *list_provider->GetWindowList().rbegin()); | 90 EXPECT_EQ(windows[1], *list_provider->GetCurrentWindowList().rbegin()); |
| 91 | 91 |
| 92 controller->ActivateSplitMode(windows[4], windows[5]); | 92 controller->ActivateSplitMode(windows[4], windows[5]); |
| 93 EXPECT_EQ(windows[4], controller->left_window()); | 93 EXPECT_EQ(windows[4], controller->left_window()); |
| 94 EXPECT_EQ(windows[5], controller->right_window()); | 94 EXPECT_EQ(windows[5], controller->right_window()); |
| 95 EXPECT_EQ(windows[4], *list_provider->GetWindowList().rbegin()); | 95 EXPECT_EQ(windows[4], *list_provider->GetCurrentWindowList().rbegin()); |
| 96 EXPECT_EQ(windows[5], *(list_provider->GetWindowList().rbegin() + 1)); | 96 EXPECT_EQ(windows[5], *(list_provider->GetCurrentWindowList().rbegin() + 1)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 TEST_F(SplitViewControllerTest, LandscapeOnly) { | 99 TEST_F(SplitViewControllerTest, LandscapeOnly) { |
| 100 aura::test::TestWindowDelegate delegate; | 100 aura::test::TestWindowDelegate delegate; |
| 101 ScopedVector<aura::Window> windows; | 101 ScopedVector<aura::Window> windows; |
| 102 const int kNumWindows = 2; | 102 const int kNumWindows = 2; |
| 103 for (size_t i = 0; i < kNumWindows; ++i) { | 103 for (size_t i = 0; i < kNumWindows; ++i) { |
| 104 scoped_ptr<aura::Window> window = CreateTestWindow(NULL, gfx::Rect()); | 104 scoped_ptr<aura::Window> window = CreateTestWindow(NULL, gfx::Rect()); |
| 105 windows.push_back(window.release()); | 105 windows.push_back(window.release()); |
| 106 } | 106 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 127 // Entering splitview should now be disabled now that the screen is in a | 127 // Entering splitview should now be disabled now that the screen is in a |
| 128 // portrait orientation. | 128 // portrait orientation. |
| 129 EXPECT_FALSE(IsSplitViewAllowed()); | 129 EXPECT_FALSE(IsSplitViewAllowed()); |
| 130 | 130 |
| 131 // Rotating back to 0 allows splitview again. | 131 // Rotating back to 0 allows splitview again. |
| 132 ScreenManager::Get()->SetRotation(gfx::Display::ROTATE_0); | 132 ScreenManager::Get()->SetRotation(gfx::Display::ROTATE_0); |
| 133 EXPECT_TRUE(IsSplitViewAllowed()); | 133 EXPECT_TRUE(IsSplitViewAllowed()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace athena | 136 } // namespace athena |
| OLD | NEW |