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/public/window_manager.h" | 5 #include "athena/wm/public/window_manager.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/split_view_controller.h" | 10 #include "athena/wm/split_view_controller.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | 148 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
149 | 149 |
150 EXPECT_EQ(third.get(), | 150 EXPECT_EQ(third.get(), |
151 wm_api.GetWindowListProvider()->GetWindowList().back()); | 151 wm_api.GetWindowListProvider()->GetWindowList().back()); |
152 | 152 |
153 // Do a two-finger swipe from the left bezel. | 153 // Do a two-finger swipe from the left bezel. |
154 ui::test::EventGenerator generator(root_window()); | 154 ui::test::EventGenerator generator(root_window()); |
155 const gfx::Point left_bezel_points[2] = { | 155 const gfx::Point left_bezel_points[2] = { |
156 gfx::Point(2, 10), gfx::Point(4, 20), | 156 gfx::Point(2, 10), gfx::Point(4, 20), |
157 }; | 157 }; |
158 const int kEventTimeSepration = 16; | 158 const int kEventTimeSeparation = 16; |
159 int width = root_window()->bounds().width(); | 159 int width = root_window()->bounds().width(); |
160 generator.GestureMultiFingerScroll( | 160 generator.GestureMultiFingerScroll( |
161 2, left_bezel_points, kEventTimeSepration, 1, width, 0); | 161 2, left_bezel_points, kEventTimeSeparation, 1, width, 0); |
162 EXPECT_TRUE(wm::IsActiveWindow(second.get())); | 162 EXPECT_TRUE(wm::IsActiveWindow(second.get())); |
163 EXPECT_EQ(second.get(), | 163 EXPECT_EQ(second.get(), |
164 wm_api.GetWindowListProvider()->GetWindowList().back()); | 164 wm_api.GetWindowListProvider()->GetWindowList().back()); |
| 165 |
| 166 // Do a two-finger swipe from the right bezel. |
| 167 const gfx::Point right_bezel_points[2] = { |
| 168 gfx::Point(width - 5, 10), |
| 169 gfx::Point(width - 10, 20) |
| 170 }; |
| 171 generator.GestureMultiFingerScroll( |
| 172 2, right_bezel_points, kEventTimeSeparation, 1, -width, 0); |
| 173 EXPECT_TRUE(wm::IsActiveWindow(third.get())); |
| 174 EXPECT_EQ(third.get(), |
| 175 wm_api.GetWindowListProvider()->GetWindowList().back()); |
165 } | 176 } |
166 | 177 |
167 TEST_F(WindowManagerTest, TitleDragSwitchBetweenWindows) { | 178 TEST_F(WindowManagerTest, TitleDragSwitchBetweenWindows) { |
168 aura::test::TestWindowDelegate delegate; | 179 aura::test::TestWindowDelegate delegate; |
169 delegate.set_window_component(HTCAPTION); | 180 delegate.set_window_component(HTCAPTION); |
170 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); | 181 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); |
171 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); | 182 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); |
172 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); | 183 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); |
173 | 184 |
174 test::WindowManagerImplTestApi wm_api; | 185 test::WindowManagerImplTestApi wm_api; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); | 374 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); |
364 overview_delegate->OnSelectWindow(w1.get()); | 375 overview_delegate->OnSelectWindow(w1.get()); |
365 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); | 376 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); |
366 EXPECT_TRUE(w1->IsVisible()); | 377 EXPECT_TRUE(w1->IsVisible()); |
367 // Make sure the windows that were in split-view mode are hidden. | 378 // Make sure the windows that were in split-view mode are hidden. |
368 EXPECT_FALSE(w2->IsVisible()); | 379 EXPECT_FALSE(w2->IsVisible()); |
369 EXPECT_FALSE(w3->IsVisible()); | 380 EXPECT_FALSE(w3->IsVisible()); |
370 } | 381 } |
371 | 382 |
372 } // namespace athena | 383 } // namespace athena |
OLD | NEW |