| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | 290 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
| 277 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); | 291 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); |
| 278 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); | 292 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
| 279 | 293 |
| 280 third->Hide(); | 294 third->Hide(); |
| 281 EXPECT_EQ(left_bounds.ToString(), | 295 EXPECT_EQ(left_bounds.ToString(), |
| 282 wm_api.split_view_controller()->left_window()->bounds().ToString()); | 296 wm_api.split_view_controller()->left_window()->bounds().ToString()); |
| 283 } | 297 } |
| 284 | 298 |
| 285 } // namespace athena | 299 } // namespace athena |
| OLD | NEW |