OLD | NEW |
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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 generator.GestureScrollSequence(location, end, | 398 generator.GestureScrollSequence(location, end, |
399 base::TimeDelta::FromMilliseconds(5), | 399 base::TimeDelta::FromMilliseconds(5), |
400 10); | 400 10); |
401 RunAllPendingInMessageLoop(); | 401 RunAllPendingInMessageLoop(); |
402 | 402 |
403 // Verify that the window has moved after the gesture. | 403 // Verify that the window has moved after the gesture. |
404 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); | 404 EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); |
405 EXPECT_EQ(snapped_bounds.ToString(), target->bounds().ToString()); | 405 EXPECT_EQ(snapped_bounds.ToString(), target->bounds().ToString()); |
406 } | 406 } |
407 | 407 |
| 408 // Resetting the bounds avoids a situation when the initial drag before |
| 409 // the fling results in target getting stuck at the edge and fling |
| 410 // incrementing the snapping sequence against our assumptions. |
| 411 target->SetBounds(gfx::Rect(700, 0, 100, 100)); |
408 old_bounds = target->bounds(); | 412 old_bounds = target->bounds(); |
409 | 413 |
410 // Snap left. | 414 // Snap left. |
411 { | 415 { |
412 // Get the expected snapped bounds before snapping. | 416 // Get the expected snapped bounds before snapping. |
413 internal::SnapSizer sizer(window_state, location, | 417 internal::SnapSizer sizer(window_state, location, |
414 internal::SnapSizer::LEFT_EDGE, | 418 internal::SnapSizer::LEFT_EDGE, |
415 internal::SnapSizer::OTHER_INPUT); | 419 internal::SnapSizer::OTHER_INPUT); |
416 gfx::Rect snapped_bounds = sizer.GetSnapBounds(target->bounds()); | 420 gfx::Rect snapped_bounds = sizer.GetSnapBounds(target->bounds()); |
417 end = location = target->GetBoundsInRootWindow().CenterPoint(); | 421 end = location = target->GetBoundsInRootWindow().CenterPoint(); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 RunAllPendingInMessageLoop(); | 689 RunAllPendingInMessageLoop(); |
686 EXPECT_EQ("10,11 100x100", target->bounds().ToString()); | 690 EXPECT_EQ("10,11 100x100", target->bounds().ToString()); |
687 } | 691 } |
688 } | 692 } |
689 | 693 |
690 // Showing the resize shadows when the mouse is over the window edges is tested | 694 // Showing the resize shadows when the mouse is over the window edges is tested |
691 // in resize_shadow_and_cursor_test.cc | 695 // in resize_shadow_and_cursor_test.cc |
692 | 696 |
693 } // namespace test | 697 } // namespace test |
694 } // namespace ash | 698 } // namespace ash |
OLD | NEW |