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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc

Issue 309793005: Fixing problem with edge swipe exiting immersive mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 6 years, 6 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 | Annotate | Revision Log
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 "ash/wm/maximize_mode/maximize_mode_window_manager.h" 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1148
1149 // Try the same again and see that nothing changes. 1149 // Try the same again and see that nothing changes.
1150 generator.GestureTapAt( 1150 generator.GestureTapAt(
1151 gfx::Point(100, Shell::GetPrimaryRootWindow()->bounds().bottom() - 1)); 1151 gfx::Point(100, Shell::GetPrimaryRootWindow()->bounds().bottom() - 1));
1152 EXPECT_FALSE(foreground_window_state->IsFullscreen()); 1152 EXPECT_FALSE(foreground_window_state->IsFullscreen());
1153 EXPECT_TRUE(background_window_state->IsFullscreen()); 1153 EXPECT_TRUE(background_window_state->IsFullscreen());
1154 1154
1155 DestroyMaximizeModeWindowManager(); 1155 DestroyMaximizeModeWindowManager();
1156 } 1156 }
1157 1157
1158 // Test that an edge swipe from the top on an immersive mode window will not end
1159 // full screen mode.
1160 TEST_F(MaximizeModeWindowManagerTest, NoExitImmersiveModeWithEdgeSwipeFromTop) {
1161 scoped_ptr<aura::Window> window(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL,
1162 gfx::Rect(10, 10, 200, 50)));
1163 wm::WindowState* window_state = wm::GetWindowState(window.get());
1164 wm::ActivateWindow(window.get());
1165 CreateMaximizeModeWindowManager();
1166
1167 // Fullscreen the window.
1168 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
1169 window_state->OnWMEvent(&event);
1170 EXPECT_TRUE(window_state->IsFullscreen());
1171 EXPECT_FALSE(window_state->in_immersive_fullscreen());
pkotwicz 2014/06/02 22:27:58 For the sake of the record (in case someone looks
Mr4D (OOO till 08-26) 2014/06/03 14:36:40 Aaargh. I am not sure where the activation line we
1172 EXPECT_EQ(window.get(), wm::GetActiveWindow());
1173
1174 // Do an edge swipe top into screen.
1175 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
1176 generator.GestureScrollSequence(gfx::Point(50, 0),
1177 gfx::Point(50, 100),
1178 base::TimeDelta::FromMilliseconds(20),
1179 10);
1180
1181 // It should have not exited full screen or immersive mode.
1182 EXPECT_TRUE(window_state->IsFullscreen());
1183 EXPECT_TRUE(window_state->in_immersive_fullscreen());
1184
1185 DestroyMaximizeModeWindowManager();
1186 }
1187
1188 // Test that an edge swipe from the bottom will not end immersive mode.
1189 TEST_F(MaximizeModeWindowManagerTest,
1190 NoExitImmersiveModeWithEdgeSwipeFromBottom) {
1191 scoped_ptr<aura::Window> window(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL,
1192 gfx::Rect(10, 10, 200, 50)));
1193 wm::WindowState* window_state = wm::GetWindowState(window.get());
1194 wm::ActivateWindow(window.get());
1195 CreateMaximizeModeWindowManager();
1196
1197 // Fullscreen the window.
1198 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
1199 window_state->OnWMEvent(&event);
1200 EXPECT_TRUE(window_state->IsFullscreen());
1201 EXPECT_FALSE(window_state->in_immersive_fullscreen());
1202 EXPECT_EQ(window.get(), wm::GetActiveWindow());
1203 window_state->set_in_immersive_fullscreen(true);
1204 EXPECT_TRUE(window_state->in_immersive_fullscreen());
1205
1206 // Do an edge swipe bottom into screen.
1207 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
1208 int y = Shell::GetPrimaryRootWindow()->bounds().bottom();
1209 generator.GestureScrollSequence(gfx::Point(50, y),
1210 gfx::Point(50, y - 100),
1211 base::TimeDelta::FromMilliseconds(20),
1212 10);
1213
1214 // The window should still be full screen and immersive.
1215 EXPECT_TRUE(window_state->IsFullscreen());
1216 EXPECT_TRUE(window_state->in_immersive_fullscreen());
1217
1218 DestroyMaximizeModeWindowManager();
1219 }
1220
1158 #endif // OS_WIN 1221 #endif // OS_WIN
1159 1222
1160 } // namespace ash 1223 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698