| 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/base/athena_test_base.h" | 8 #include "athena/test/base/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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 wm_api.GetSplitViewController()->left_window()->bounds(); | 301 wm_api.GetSplitViewController()->left_window()->bounds(); |
| 302 EXPECT_NE(work_area.ToString(), | 302 EXPECT_NE(work_area.ToString(), |
| 303 left_bounds.size().ToString()); | 303 left_bounds.size().ToString()); |
| 304 | 304 |
| 305 // A new window should replace the left window when in split view. | 305 // A new window should replace the left window when in split view. |
| 306 scoped_ptr<aura::Window> third(CreateAndActivateWindow(&delegate)); | 306 scoped_ptr<aura::Window> third(CreateAndActivateWindow(&delegate)); |
| 307 EXPECT_EQ(wm_api.GetSplitViewController()->left_window(), third.get()); | 307 EXPECT_EQ(wm_api.GetSplitViewController()->left_window(), third.get()); |
| 308 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); | 308 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
| 309 } | 309 } |
| 310 | 310 |
| 311 TEST_F(WindowManagerTest, OverviewModeAccelerators) { |
| 312 ui::test::EventGenerator generator(root_window()); |
| 313 |
| 314 // F6 toggles overview mode |
| 315 ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive()); |
| 316 generator.PressKey(ui::VKEY_F6, ui::EF_NONE); |
| 317 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); |
| 318 generator.PressKey(ui::VKEY_F6, ui::EF_NONE); |
| 319 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive()); |
| 320 |
| 321 // ESC exits overview mode |
| 322 generator.PressKey(ui::VKEY_F6, ui::EF_NONE); |
| 323 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive()); |
| 324 generator.PressKey(ui::VKEY_ESCAPE, ui::EF_NONE); |
| 325 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive()); |
| 326 } |
| 327 |
| 311 TEST_F(WindowManagerTest, SplitModeActivationByShortcut) { | 328 TEST_F(WindowManagerTest, SplitModeActivationByShortcut) { |
| 312 test::WindowManagerImplTestApi wm_api; | 329 test::WindowManagerImplTestApi wm_api; |
| 313 | 330 |
| 314 aura::test::TestWindowDelegate delegate; | 331 aura::test::TestWindowDelegate delegate; |
| 315 scoped_ptr<aura::Window> w1(CreateAndActivateWindow(&delegate)); | 332 scoped_ptr<aura::Window> w1(CreateAndActivateWindow(&delegate)); |
| 316 | 333 |
| 317 // Splitview mode needs at least two windows. | 334 // Splitview mode needs at least two windows. |
| 318 wm_api.wm()->ToggleSplitView(); | 335 wm_api.wm()->ToggleSplitView(); |
| 319 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); | 336 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); |
| 320 | 337 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); | 372 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); |
| 356 overview_delegate->OnSelectWindow(w1.get()); | 373 overview_delegate->OnSelectWindow(w1.get()); |
| 357 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); | 374 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); |
| 358 EXPECT_TRUE(w1->IsVisible()); | 375 EXPECT_TRUE(w1->IsVisible()); |
| 359 // Make sure the windows that were in split-view mode are hidden. | 376 // Make sure the windows that were in split-view mode are hidden. |
| 360 EXPECT_FALSE(w2->IsVisible()); | 377 EXPECT_FALSE(w2->IsVisible()); |
| 361 EXPECT_FALSE(w3->IsVisible()); | 378 EXPECT_FALSE(w3->IsVisible()); |
| 362 } | 379 } |
| 363 | 380 |
| 364 } // namespace athena | 381 } // namespace athena |
| OLD | NEW |