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

Side by Side Diff: ash/wm/caption_buttons/alternate_frame_size_button_unittest.cc

Issue 169713003: Remove WindowState::IsNormalShowState() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/wm/caption_buttons/frame_maximize_button_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/caption_buttons/alternate_frame_size_button.h" 5 #include "ash/wm/caption_buttons/alternate_frame_size_button.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/caption_buttons/frame_caption_button.h" 10 #include "ash/wm/caption_buttons/frame_caption_button.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_TRUE(window_state()->IsMaximized()); 204 EXPECT_TRUE(window_state()->IsMaximized());
205 205
206 generator.GestureTapAt(CenterPointInScreen(size_button())); 206 generator.GestureTapAt(CenterPointInScreen(size_button()));
207 RunAllPendingInMessageLoop(); 207 RunAllPendingInMessageLoop();
208 EXPECT_FALSE(window_state()->IsMaximized()); 208 EXPECT_FALSE(window_state()->IsMaximized());
209 } 209 }
210 210
211 // Test that clicking + dragging to a button adjacent to the size button snaps 211 // Test that clicking + dragging to a button adjacent to the size button snaps
212 // the window left or right. 212 // the window left or right.
213 TEST_F(AlternateFrameSizeButtonTest, ButtonDrag) { 213 TEST_F(AlternateFrameSizeButtonTest, ButtonDrag) {
214 EXPECT_TRUE(window_state()->IsNormalShowState()); 214 EXPECT_TRUE(window_state()->IsNormalShowType());
215 EXPECT_FALSE(window_state()->IsSnapped());
216 215
217 // 1) Test by dragging the mouse. 216 // 1) Test by dragging the mouse.
218 // Snap right. 217 // Snap right.
219 aura::test::EventGenerator& generator = GetEventGenerator(); 218 aura::test::EventGenerator& generator = GetEventGenerator();
220 generator.MoveMouseTo(CenterPointInScreen(size_button())); 219 generator.MoveMouseTo(CenterPointInScreen(size_button()));
221 generator.PressLeftButton(); 220 generator.PressLeftButton();
222 generator.MoveMouseTo(CenterPointInScreen(close_button())); 221 generator.MoveMouseTo(CenterPointInScreen(close_button()));
223 generator.ReleaseLeftButton(); 222 generator.ReleaseLeftButton();
224 RunAllPendingInMessageLoop(); 223 RunAllPendingInMessageLoop();
225 EXPECT_TRUE(IsSnapped(internal::SnapSizer::RIGHT_EDGE)); 224 EXPECT_TRUE(IsSnapped(internal::SnapSizer::RIGHT_EDGE));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 generator.MoveMouseTo(CenterPointInScreen(size_button())); 263 generator.MoveMouseTo(CenterPointInScreen(size_button()));
265 generator.PressMoveAndReleaseTouchTo(CenterPointInScreen(minimize_button())); 264 generator.PressMoveAndReleaseTouchTo(CenterPointInScreen(minimize_button()));
266 RunAllPendingInMessageLoop(); 265 RunAllPendingInMessageLoop();
267 EXPECT_TRUE(IsSnapped(internal::SnapSizer::LEFT_EDGE)); 266 EXPECT_TRUE(IsSnapped(internal::SnapSizer::LEFT_EDGE));
268 ui::GestureConfiguration::set_default_radius(touch_default_radius); 267 ui::GestureConfiguration::set_default_radius(touch_default_radius);
269 } 268 }
270 269
271 // Test that clicking, dragging, and overshooting the minimize button a bit 270 // Test that clicking, dragging, and overshooting the minimize button a bit
272 // horizontally still snaps the window left. 271 // horizontally still snaps the window left.
273 TEST_F(AlternateFrameSizeButtonTest, SnapLeftOvershootMinimize) { 272 TEST_F(AlternateFrameSizeButtonTest, SnapLeftOvershootMinimize) {
274 EXPECT_TRUE(window_state()->IsNormalShowState()); 273 EXPECT_TRUE(window_state()->IsNormalShowType());
275 EXPECT_FALSE(window_state()->IsSnapped());
276 274
277 aura::test::EventGenerator& generator = GetEventGenerator(); 275 aura::test::EventGenerator& generator = GetEventGenerator();
278 generator.MoveMouseTo(CenterPointInScreen(size_button())); 276 generator.MoveMouseTo(CenterPointInScreen(size_button()));
279 277
280 generator.PressLeftButton(); 278 generator.PressLeftButton();
281 // Move to the minimize button. 279 // Move to the minimize button.
282 generator.MoveMouseTo(CenterPointInScreen(minimize_button())); 280 generator.MoveMouseTo(CenterPointInScreen(minimize_button()));
283 // Overshoot the minimize button. 281 // Overshoot the minimize button.
284 generator.MoveMouseBy(-minimize_button()->width(), 0); 282 generator.MoveMouseBy(-minimize_button()->width(), 0);
285 generator.ReleaseLeftButton(); 283 generator.ReleaseLeftButton();
286 RunAllPendingInMessageLoop(); 284 RunAllPendingInMessageLoop();
287 EXPECT_TRUE(IsSnapped(internal::SnapSizer::LEFT_EDGE)); 285 EXPECT_TRUE(IsSnapped(internal::SnapSizer::LEFT_EDGE));
288 } 286 }
289 287
290 // Test that right clicking the size button has no effect. 288 // Test that right clicking the size button has no effect.
291 TEST_F(AlternateFrameSizeButtonTest, RightMouseButton) { 289 TEST_F(AlternateFrameSizeButtonTest, RightMouseButton) {
292 EXPECT_TRUE(window_state()->IsNormalShowState()); 290 EXPECT_TRUE(window_state()->IsNormalShowType());
293 EXPECT_FALSE(window_state()->IsSnapped());
294 291
295 aura::test::EventGenerator& generator = GetEventGenerator(); 292 aura::test::EventGenerator& generator = GetEventGenerator();
296 generator.MoveMouseTo(CenterPointInScreen(size_button())); 293 generator.MoveMouseTo(CenterPointInScreen(size_button()));
297 generator.PressRightButton(); 294 generator.PressRightButton();
298 generator.ReleaseRightButton(); 295 generator.ReleaseRightButton();
299 RunAllPendingInMessageLoop(); 296 RunAllPendingInMessageLoop();
300 EXPECT_TRUE(window_state()->IsNormalShowState()); 297 EXPECT_TRUE(window_state()->IsNormalShowType());
301 EXPECT_FALSE(window_state()->IsSnapped());
302 } 298 }
303 299
304 // Test that upon releasing the mouse button after having pressed the size 300 // Test that upon releasing the mouse button after having pressed the size
305 // button 301 // button
306 // - The state of all the caption buttons is reset. 302 // - The state of all the caption buttons is reset.
307 // - The icon displayed by all of the caption buttons is reset. 303 // - The icon displayed by all of the caption buttons is reset.
308 TEST_F(AlternateFrameSizeButtonTest, ResetButtonsAfterClick) { 304 TEST_F(AlternateFrameSizeButtonTest, ResetButtonsAfterClick) {
309 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); 305 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon());
310 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); 306 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon());
311 EXPECT_TRUE(AllButtonsInNormalState()); 307 EXPECT_TRUE(AllButtonsInNormalState());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); 403 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left());
408 EXPECT_TRUE(AllButtonsInNormalState()); 404 EXPECT_TRUE(AllButtonsInNormalState());
409 generator.MoveMouseTo(CenterPointInScreen(close_button())); 405 generator.MoveMouseTo(CenterPointInScreen(close_button()));
410 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); 406 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state());
411 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); 407 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
412 EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state()); 408 EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state());
413 } 409 }
414 410
415 } // namespace test 411 } // namespace test
416 } // namespace ash 412 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/wm/caption_buttons/frame_maximize_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698