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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // Do a title-swipe from the top to switch to the previous window. | 173 // Do a title-swipe from the top to switch to the previous window. |
174 ui::test::EventGenerator generator(root_window()); | 174 ui::test::EventGenerator generator(root_window()); |
175 generator.GestureScrollSequence(gfx::Point(20, 10), | 175 generator.GestureScrollSequence(gfx::Point(20, 10), |
176 gfx::Point(20, 400), | 176 gfx::Point(20, 400), |
177 base::TimeDelta::FromMilliseconds(20), | 177 base::TimeDelta::FromMilliseconds(20), |
178 5); | 178 5); |
179 EXPECT_TRUE(wm::IsActiveWindow(second.get())); | 179 EXPECT_TRUE(wm::IsActiveWindow(second.get())); |
180 EXPECT_EQ(second.get(), | 180 EXPECT_EQ(second.get(), |
181 wm_api.window_list_provider()->GetWindowList().back()); | 181 wm_api.window_list_provider()->GetWindowList().back()); |
| 182 EXPECT_TRUE(second->IsVisible()); |
| 183 EXPECT_FALSE(third->IsVisible()); |
182 | 184 |
183 // Performing the same gesture again will switch back to |third|. | 185 // Performing the same gesture again will switch back to |third|. |
184 generator.GestureScrollSequence(gfx::Point(20, 10), | 186 generator.GestureScrollSequence(gfx::Point(20, 10), |
185 gfx::Point(20, 400), | 187 gfx::Point(20, 400), |
186 base::TimeDelta::FromMilliseconds(20), | 188 base::TimeDelta::FromMilliseconds(20), |
187 5); | 189 5); |
188 EXPECT_TRUE(wm::IsActiveWindow(third.get())); | 190 EXPECT_TRUE(wm::IsActiveWindow(third.get())); |
189 EXPECT_EQ(third.get(), wm_api.window_list_provider()->GetWindowList().back()); | 191 EXPECT_EQ(third.get(), wm_api.window_list_provider()->GetWindowList().back()); |
| 192 EXPECT_FALSE(second->IsVisible()); |
| 193 EXPECT_TRUE(third->IsVisible()); |
| 194 |
| 195 // Perform a swipe that doesn't go enough to perform the window switch. |
| 196 generator.GestureScrollSequence(gfx::Point(20, 10), |
| 197 gfx::Point(20, 90), |
| 198 base::TimeDelta::FromMilliseconds(20), |
| 199 5); |
| 200 EXPECT_TRUE(wm::IsActiveWindow(third.get())); |
| 201 EXPECT_EQ(third.get(), wm_api.window_list_provider()->GetWindowList().back()); |
| 202 EXPECT_FALSE(second->IsVisible()); |
| 203 EXPECT_TRUE(third->IsVisible()); |
190 } | 204 } |
191 | 205 |
192 TEST_F(WindowManagerTest, TitleDragSwitchBetweenWindowsInSplitViewMode) { | 206 TEST_F(WindowManagerTest, TitleDragSwitchBetweenWindowsInSplitViewMode) { |
193 aura::test::TestWindowDelegate delegate; | 207 aura::test::TestWindowDelegate delegate; |
194 delegate.set_window_component(HTCAPTION); | 208 delegate.set_window_component(HTCAPTION); |
195 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); | 209 scoped_ptr<aura::Window> first(CreateWindow(&delegate)); |
196 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); | 210 scoped_ptr<aura::Window> second(CreateWindow(&delegate)); |
197 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); | 211 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); |
198 scoped_ptr<aura::Window> fourth(CreateWindow(&delegate)); | 212 scoped_ptr<aura::Window> fourth(CreateWindow(&delegate)); |
199 | 213 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // Toggle back to normal mode. | 325 // Toggle back to normal mode. |
312 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); | 326 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
313 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); | 327 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
314 EXPECT_FALSE(wm_api.split_view_controller()->IsSplitViewModeActive()); | 328 EXPECT_FALSE(wm_api.split_view_controller()->IsSplitViewModeActive()); |
315 | 329 |
316 EXPECT_EQ(width, w1->bounds().width()); | 330 EXPECT_EQ(width, w1->bounds().width()); |
317 EXPECT_EQ(width, w2->bounds().width()); | 331 EXPECT_EQ(width, w2->bounds().width()); |
318 } | 332 } |
319 | 333 |
320 } // namespace athena | 334 } // namespace athena |
OLD | NEW |