Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: athena/wm/window_manager_unittest.cc

Issue 546123002: Ensure that an activity is activated when overview mode is exited (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 scoped_ptr<aura::Window> w2(CreateAndActivateWindow(&delegate)); 87 scoped_ptr<aura::Window> w2(CreateAndActivateWindow(&delegate));
88 scoped_ptr<aura::Window> w3(CreateAndActivateWindow(&delegate)); 88 scoped_ptr<aura::Window> w3(CreateAndActivateWindow(&delegate));
89 89
90 WindowManager::GetInstance()->ToggleOverview(); 90 WindowManager::GetInstance()->ToggleOverview();
91 EXPECT_TRUE(w1->IsVisible()); 91 EXPECT_TRUE(w1->IsVisible());
92 EXPECT_TRUE(w2->IsVisible()); 92 EXPECT_TRUE(w2->IsVisible());
93 EXPECT_TRUE(w3->IsVisible()); 93 EXPECT_TRUE(w3->IsVisible());
94 94
95 // Go into split-view mode. 95 // Go into split-view mode.
96 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); 96 WindowOverviewModeDelegate* overview_delegate = wm_api.wm();
97 overview_delegate->OnSplitViewMode(w3.get(), NULL); 97 overview_delegate->OnSelectSplitViewWindow(w3.get(), NULL, w3.get());
98 EXPECT_TRUE(w3->IsVisible()); 98 EXPECT_TRUE(w3->IsVisible());
99 EXPECT_TRUE(w2->IsVisible()); 99 EXPECT_TRUE(w2->IsVisible());
100 EXPECT_FALSE(w1->IsVisible()); 100 EXPECT_FALSE(w1->IsVisible());
101 } 101 }
102 102
103 TEST_F(WindowManagerTest, NewWindowFromOverview) {
104 aura::test::TestWindowDelegate delegate;
105 scoped_ptr<aura::Window> w1(CreateAndActivateWindow(&delegate));
106 scoped_ptr<aura::Window> w2(CreateAndActivateWindow(&delegate));
107
108 WindowManager::GetInstance()->ToggleOverview();
109 EXPECT_TRUE(w1->IsVisible());
110 EXPECT_TRUE(w2->IsVisible());
111
112 // Test that opening a new window exits overview mode. The new window could
113 // have been opened by JavaScript or by the home card.
114 scoped_ptr<aura::Window> w3(CreateAndActivateWindow(&delegate));
115
116 ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive());
117 EXPECT_TRUE(w3->IsVisible());
118 EXPECT_TRUE(wm::IsActiveWindow(w3.get()));
119 EXPECT_FALSE(w1->IsVisible());
120 EXPECT_FALSE(w2->IsVisible());
121 }
122
123 TEST_F(WindowManagerTest, OverviewZeroWindows) {
124 aura::test::TestWindowDelegate delegate;
125 scoped_ptr<aura::Window> w(CreateAndActivateWindow(&delegate));
126
127 WindowManager* wm = WindowManager::GetInstance();
128 wm->ToggleOverview();
129 ASSERT_TRUE(wm->IsOverviewModeActive());
130 EXPECT_TRUE(w->IsVisible());
131
132 w.reset();
133 EXPECT_TRUE(wm->IsOverviewModeActive());
134
135 // It should not be possible to exit overview mode if there are no windows
136 // open.
137 wm->ToggleOverview();
138 EXPECT_TRUE(wm->IsOverviewModeActive());
139 }
140
103 TEST_F(WindowManagerTest, BezelGestureToSplitViewMode) { 141 TEST_F(WindowManagerTest, BezelGestureToSplitViewMode) {
104 aura::test::TestWindowDelegate delegate; 142 aura::test::TestWindowDelegate delegate;
105 scoped_ptr<aura::Window> first(CreateAndActivateWindow(&delegate)); 143 scoped_ptr<aura::Window> first(CreateAndActivateWindow(&delegate));
106 scoped_ptr<aura::Window> second(CreateAndActivateWindow(&delegate)); 144 scoped_ptr<aura::Window> second(CreateAndActivateWindow(&delegate));
107 scoped_ptr<aura::Window> third(CreateAndActivateWindow(&delegate)); 145 scoped_ptr<aura::Window> third(CreateAndActivateWindow(&delegate));
108 146
109 test::WindowManagerImplTestApi wm_api; 147 test::WindowManagerImplTestApi wm_api;
110 148
111 // Test that going into split-view mode with two-finger gesture selects the 149 // Test that going into split-view mode with two-finger gesture selects the
112 // correct windows on left and right splits. 150 // correct windows on left and right splits.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); 368 WindowOverviewModeDelegate* overview_delegate = wm_api.wm();
331 overview_delegate->OnSelectWindow(w1.get()); 369 overview_delegate->OnSelectWindow(w1.get());
332 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); 370 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive());
333 EXPECT_TRUE(w1->IsVisible()); 371 EXPECT_TRUE(w1->IsVisible());
334 // Make sure the windows that were in split-view mode are hidden. 372 // Make sure the windows that were in split-view mode are hidden.
335 EXPECT_FALSE(w2->IsVisible()); 373 EXPECT_FALSE(w2->IsVisible());
336 EXPECT_FALSE(w3->IsVisible()); 374 EXPECT_FALSE(w3->IsVisible());
337 } 375 }
338 376
339 } // namespace athena 377 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698