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

Side by Side Diff: ash/wm/toplevel_window_event_handler_unittest.cc

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up unittests + varkha@'s suggestions Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/toplevel_window_event_handler.h" 5 #include "ash/wm/toplevel_window_event_handler.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 gfx::Point location(5, 5); 385 gfx::Point location(5, 5);
386 target->SetProperty(aura::client::kCanMaximizeKey, true); 386 target->SetProperty(aura::client::kCanMaximizeKey, true);
387 387
388 gfx::Point end = location; 388 gfx::Point end = location;
389 389
390 // Snap right; 390 // Snap right;
391 { 391 {
392 // Get the expected snapped bounds before snapping. 392 // Get the expected snapped bounds before snapping.
393 internal::SnapSizer sizer(target.get(), location, 393 internal::SnapSizer sizer(target.get(), location,
394 internal::SnapSizer::RIGHT_EDGE, 394 internal::SnapSizer::RIGHT_EDGE,
395 internal::SnapSizer::OTHER_INPUT); 395 internal::SnapSizer::STEP_NO);
396 gfx::Rect snapped_bounds = sizer.GetSnapBounds(target->bounds()); 396 gfx::Rect snapped_bounds = sizer.target_bounds();
397 397
398 end.Offset(100, 0); 398 end.Offset(100, 0);
399 generator.GestureScrollSequence(location, end, 399 generator.GestureScrollSequence(location, end,
400 base::TimeDelta::FromMilliseconds(5), 400 base::TimeDelta::FromMilliseconds(5),
401 10); 401 10);
402 RunAllPendingInMessageLoop(); 402 RunAllPendingInMessageLoop();
403 403
404 // Verify that the window has moved after the gesture. 404 // Verify that the window has moved after the gesture.
405 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); 405 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString());
406 EXPECT_EQ(snapped_bounds.ToString(), target->bounds().ToString()); 406 EXPECT_EQ(snapped_bounds.ToString(), target->bounds().ToString());
407 } 407 }
408 408
409 old_bounds = target->bounds(); 409 old_bounds = target->bounds();
410 410
411 // Snap left. 411 // Snap left.
412 { 412 {
413 // Get the expected snapped bounds before snapping. 413 // Get the expected snapped bounds before snapping.
414 internal::SnapSizer sizer(target.get(), location, 414 internal::SnapSizer sizer(target.get(), location,
415 internal::SnapSizer::LEFT_EDGE, 415 internal::SnapSizer::LEFT_EDGE,
416 internal::SnapSizer::OTHER_INPUT); 416 internal::SnapSizer::STEP_NO);
417 gfx::Rect snapped_bounds = sizer.GetSnapBounds(target->bounds()); 417 gfx::Rect snapped_bounds = sizer.target_bounds();
418 end = location = target->GetBoundsInRootWindow().CenterPoint(); 418 end = location = target->GetBoundsInRootWindow().CenterPoint();
419 end.Offset(-100, 0); 419 end.Offset(-100, 0);
420 generator.GestureScrollSequence(location, end, 420 generator.GestureScrollSequence(location, end,
421 base::TimeDelta::FromMilliseconds(5), 421 base::TimeDelta::FromMilliseconds(5),
422 10); 422 10);
423 RunAllPendingInMessageLoop(); 423 RunAllPendingInMessageLoop();
424 424
425 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); 425 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString());
426 EXPECT_EQ(snapped_bounds.ToString(), target->bounds().ToString()); 426 EXPECT_EQ(snapped_bounds.ToString(), target->bounds().ToString());
427 } 427 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 target->SetProperty(aura::client::kCanResizeKey, false); 526 target->SetProperty(aura::client::kCanResizeKey, false);
527 527
528 gfx::Point end = location; 528 gfx::Point end = location;
529 529
530 // Try to snap right. The window is not resizable. So it should not snap. 530 // Try to snap right. The window is not resizable. So it should not snap.
531 { 531 {
532 // Get the expected snapped bounds before the gesture. 532 // Get the expected snapped bounds before the gesture.
533 internal::SnapSizer sizer(target.get(), location, 533 internal::SnapSizer sizer(target.get(), location,
534 internal::SnapSizer::RIGHT_EDGE, 534 internal::SnapSizer::RIGHT_EDGE,
535 internal::SnapSizer::OTHER_INPUT); 535 internal::SnapSizer::STEP_NO);
536 gfx::Rect snapped_bounds = sizer.GetSnapBounds(target->bounds()); 536 gfx::Rect snapped_bounds = sizer.target_bounds();
537 537
538 end.Offset(100, 0); 538 end.Offset(100, 0);
539 generator.GestureScrollSequence(location, end, 539 generator.GestureScrollSequence(location, end,
540 base::TimeDelta::FromMilliseconds(5), 540 base::TimeDelta::FromMilliseconds(5),
541 10); 541 10);
542 RunAllPendingInMessageLoop(); 542 RunAllPendingInMessageLoop();
543 543
544 // Verify that the window has moved after the gesture. 544 // Verify that the window has moved after the gesture.
545 gfx::Rect expected_bounds(old_bounds); 545 gfx::Rect expected_bounds(old_bounds);
546 expected_bounds.Offset(gfx::Vector2d(100, 0)); 546 expected_bounds.Offset(gfx::Vector2d(100, 0));
547 EXPECT_EQ(expected_bounds.ToString(), target->bounds().ToString()); 547 EXPECT_EQ(expected_bounds.ToString(), target->bounds().ToString());
548 548
549 // Verify that the window did not snap left. 549 // Verify that the window did not snap left.
550 EXPECT_NE(snapped_bounds.ToString(), target->bounds().ToString()); 550 EXPECT_NE(snapped_bounds.ToString(), target->bounds().ToString());
551 } 551 }
552 552
553 old_bounds = target->bounds(); 553 old_bounds = target->bounds();
554 554
555 // Try to snap left. It should not snap. 555 // Try to snap left. It should not snap.
556 { 556 {
557 // Get the expected snapped bounds before the gesture. 557 // Get the expected snapped bounds before the gesture.
558 internal::SnapSizer sizer(target.get(), location, 558 internal::SnapSizer sizer(target.get(), location,
559 internal::SnapSizer::LEFT_EDGE, 559 internal::SnapSizer::LEFT_EDGE,
560 internal::SnapSizer::OTHER_INPUT); 560 internal::SnapSizer::STEP_NO);
561 gfx::Rect snapped_bounds = sizer.GetSnapBounds(target->bounds()); 561 gfx::Rect snapped_bounds = sizer.target_bounds();
562 end = location = target->GetBoundsInRootWindow().CenterPoint(); 562 end = location = target->GetBoundsInRootWindow().CenterPoint();
563 end.Offset(-100, 0); 563 end.Offset(-100, 0);
564 generator.GestureScrollSequence(location, end, 564 generator.GestureScrollSequence(location, end,
565 base::TimeDelta::FromMilliseconds(5), 565 base::TimeDelta::FromMilliseconds(5),
566 10); 566 10);
567 RunAllPendingInMessageLoop(); 567 RunAllPendingInMessageLoop();
568 568
569 // Verify that the window has moved after the gesture. 569 // Verify that the window has moved after the gesture.
570 gfx::Rect expected_bounds(old_bounds); 570 gfx::Rect expected_bounds(old_bounds);
571 expected_bounds.Offset(gfx::Vector2d(-100, 0)); 571 expected_bounds.Offset(gfx::Vector2d(-100, 0));
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 807
808 // Move mouse out of the window. Shadows should disappear. 808 // Move mouse out of the window. Shadows should disappear.
809 generator.MoveMouseTo(150, 150); 809 generator.MoveMouseTo(150, 150);
810 EXPECT_FALSE(HasResizeShadow()); 810 EXPECT_FALSE(HasResizeShadow());
811 811
812 RunAllPendingInMessageLoop(); 812 RunAllPendingInMessageLoop();
813 } 813 }
814 814
815 } // namespace test 815 } // namespace test
816 } // namespace ash 816 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698