| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/web_contents/aura/window_slider.h" | 5 #include "content/browser/web_contents/aura/window_slider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // that the second swipe occurs while the transition animation triggered by the | 582 // that the second swipe occurs while the transition animation triggered by the |
| 583 // first swipe is in progress. | 583 // first swipe is in progress. |
| 584 // The second swipe is supposed to instantly complete the animation caused by | 584 // The second swipe is supposed to instantly complete the animation caused by |
| 585 // the first swipe, ask the delegate to create a new layer, and animate it. | 585 // the first swipe, ask the delegate to create a new layer, and animate it. |
| 586 TEST_F(WindowSliderTest, SwipeDuringSwipeAnimation) { | 586 TEST_F(WindowSliderTest, SwipeDuringSwipeAnimation) { |
| 587 scoped_ptr<aura::Window> window(CreateNormalWindow(0, root_window(), NULL)); | 587 scoped_ptr<aura::Window> window(CreateNormalWindow(0, root_window(), NULL)); |
| 588 window->SetBounds(gfx::Rect(0, 0, 400, 400)); | 588 window->SetBounds(gfx::Rect(0, 0, 400, 400)); |
| 589 WindowSliderDelegateTest slider_delegate; | 589 WindowSliderDelegateTest slider_delegate; |
| 590 new WindowSlider(&slider_delegate, root_window(), window.get()); | 590 new WindowSlider(&slider_delegate, root_window(), window.get()); |
| 591 | 591 |
| 592 // This test uses explicit durations so needs a normal duration. | 592 ui::ScopedAnimationDurationScaleMode normal_duration_( |
| 593 ui::ScopedAnimationDurationScaleMode normal_duration( | |
| 594 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | 593 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); |
| 595 ui::LayerAnimator* animator = window->layer()->GetAnimator(); | 594 ui::LayerAnimator* animator = window->layer()->GetAnimator(); |
| 596 animator->set_disable_timer_for_test(true); | 595 animator->set_disable_timer_for_test(true); |
| 597 ui::LayerAnimatorTestController test_controller(animator); | 596 ui::LayerAnimatorTestController test_controller(animator); |
| 598 | 597 |
| 599 ui::test::EventGenerator generator(root_window()); | 598 ui::test::EventGenerator generator(root_window()); |
| 600 | 599 |
| 601 // Swipe forward so that |window|'s layer is the one animating. | 600 // Swipe forward so that |window|'s layer is the one animating. |
| 602 generator.GestureScrollSequence( | 601 generator.GestureScrollSequence( |
| 603 gfx::Point(10, 10), | 602 gfx::Point(10, 10), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 animator->Step(start_time2 + duration); | 638 animator->Step(start_time2 + duration); |
| 640 // The animation for the second slide should now be completed. | 639 // The animation for the second slide should now be completed. |
| 641 EXPECT_TRUE(slider_delegate.slide_completed()); | 640 EXPECT_TRUE(slider_delegate.slide_completed()); |
| 642 slider_delegate.Reset(); | 641 slider_delegate.Reset(); |
| 643 | 642 |
| 644 window.reset(); | 643 window.reset(); |
| 645 EXPECT_TRUE(slider_delegate.slider_destroyed()); | 644 EXPECT_TRUE(slider_delegate.slider_destroyed()); |
| 646 } | 645 } |
| 647 | 646 |
| 648 } // namespace content | 647 } // namespace content |
| OLD | NEW |