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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 aura::client::ParentWindowWithContext( | 275 aura::client::ParentWindowWithContext( |
276 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | 276 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
277 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); | 277 EXPECT_NE(wm_api.split_view_controller()->left_window(), third.get()); |
278 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); | 278 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
279 | 279 |
280 third->Hide(); | 280 third->Hide(); |
281 EXPECT_EQ(left_bounds.ToString(), | 281 EXPECT_EQ(left_bounds.ToString(), |
282 wm_api.split_view_controller()->left_window()->bounds().ToString()); | 282 wm_api.split_view_controller()->left_window()->bounds().ToString()); |
283 } | 283 } |
284 | 284 |
| 285 TEST_F(WindowManagerTest, SplitModeActivationByShortcut) { |
| 286 WindowManagerImplTestApi wm_api; |
| 287 |
| 288 aura::test::TestWindowDelegate delegate; |
| 289 scoped_ptr<aura::Window> w1(CreateTestWindow(&delegate, gfx::Rect())); |
| 290 w1->Show(); |
| 291 |
| 292 ui::test::EventGenerator generator(root_window()); |
| 293 |
| 294 // Splitview mode needs at least two windows. |
| 295 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
| 296 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
| 297 EXPECT_FALSE(wm_api.split_view_controller()->IsSplitViewModeActive()); |
| 298 |
| 299 scoped_ptr<aura::Window> w2(CreateTestWindow(&delegate, gfx::Rect())); |
| 300 w2->Show(); |
| 301 |
| 302 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
| 303 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
| 304 EXPECT_TRUE(wm_api.split_view_controller()->IsSplitViewModeActive()); |
| 305 int width = |
| 306 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().width(); |
| 307 |
| 308 EXPECT_EQ(width / 2, w1->bounds().width()); |
| 309 EXPECT_EQ(width / 2, w2->bounds().width()); |
| 310 |
| 311 // Toggle back to normal mode. |
| 312 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
| 313 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
| 314 EXPECT_FALSE(wm_api.split_view_controller()->IsSplitViewModeActive()); |
| 315 |
| 316 EXPECT_EQ(width, w1->bounds().width()); |
| 317 EXPECT_EQ(width, w2->bounds().width()); |
| 318 } |
| 319 |
285 } // namespace athena | 320 } // namespace athena |
OLD | NEW |