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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 second.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | 261 second.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
262 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); | 262 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); |
263 | 263 |
264 // Get into split view. | 264 // Get into split view. |
265 wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL); | 265 wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL); |
266 const gfx::Rect left_bounds = | 266 const gfx::Rect left_bounds = |
267 wm_api.GetSplitViewController()->left_window()->bounds(); | 267 wm_api.GetSplitViewController()->left_window()->bounds(); |
268 EXPECT_NE(work_area.ToString(), | 268 EXPECT_NE(work_area.ToString(), |
269 left_bounds.size().ToString()); | 269 left_bounds.size().ToString()); |
270 | 270 |
| 271 // A new window should replace the left window when in split view. |
271 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); | 272 scoped_ptr<aura::Window> third(CreateWindow(&delegate)); |
272 aura::client::ParentWindowWithContext( | 273 aura::client::ParentWindowWithContext( |
273 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | 274 third.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); |
274 EXPECT_NE(wm_api.GetSplitViewController()->left_window(), third.get()); | 275 EXPECT_EQ(wm_api.GetSplitViewController()->left_window(), third.get()); |
275 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); | 276 EXPECT_EQ(left_bounds.ToString(), third->bounds().ToString()); |
276 | |
277 third->Hide(); | |
278 EXPECT_EQ( | |
279 left_bounds.ToString(), | |
280 wm_api.GetSplitViewController()->left_window()->bounds().ToString()); | |
281 } | 277 } |
282 | 278 |
283 TEST_F(WindowManagerTest, SplitModeActivationByShortcut) { | 279 TEST_F(WindowManagerTest, SplitModeActivationByShortcut) { |
284 test::WindowManagerImplTestApi wm_api; | 280 test::WindowManagerImplTestApi wm_api; |
285 | 281 |
286 aura::test::TestWindowDelegate delegate; | 282 aura::test::TestWindowDelegate delegate; |
287 scoped_ptr<aura::Window> w1(CreateTestWindow(&delegate, gfx::Rect())); | 283 scoped_ptr<aura::Window> w1(CreateTestWindow(&delegate, gfx::Rect())); |
288 w1->Show(); | 284 w1->Show(); |
289 | 285 |
290 ui::test::EventGenerator generator(root_window()); | 286 ui::test::EventGenerator generator(root_window()); |
(...skipping 18 matching lines...) Expand all Loading... |
309 // Toggle back to normal mode. | 305 // Toggle back to normal mode. |
310 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); | 306 generator.PressKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
311 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); | 307 generator.ReleaseKey(ui::VKEY_F6, ui::EF_CONTROL_DOWN); |
312 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); | 308 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); |
313 | 309 |
314 EXPECT_EQ(width, w1->bounds().width()); | 310 EXPECT_EQ(width, w1->bounds().width()); |
315 EXPECT_EQ(width, w2->bounds().width()); | 311 EXPECT_EQ(width, w2->bounds().width()); |
316 } | 312 } |
317 | 313 |
318 } // namespace athena | 314 } // namespace athena |
OLD | NEW |