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 ui::ScopedAnimationDurationScaleMode normal_duration_( | 592 // This test uses explicit durations so needs a normal duration. |
| 593 ui::ScopedAnimationDurationScaleMode normal_duration( |
593 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | 594 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); |
594 ui::LayerAnimator* animator = window->layer()->GetAnimator(); | 595 ui::LayerAnimator* animator = window->layer()->GetAnimator(); |
595 animator->set_disable_timer_for_test(true); | 596 animator->set_disable_timer_for_test(true); |
596 ui::LayerAnimatorTestController test_controller(animator); | 597 ui::LayerAnimatorTestController test_controller(animator); |
597 | 598 |
598 ui::test::EventGenerator generator(root_window()); | 599 ui::test::EventGenerator generator(root_window()); |
599 | 600 |
600 // Swipe forward so that |window|'s layer is the one animating. | 601 // Swipe forward so that |window|'s layer is the one animating. |
601 generator.GestureScrollSequence( | 602 generator.GestureScrollSequence( |
602 gfx::Point(10, 10), | 603 gfx::Point(10, 10), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 animator->Step(start_time2 + duration); | 639 animator->Step(start_time2 + duration); |
639 // The animation for the second slide should now be completed. | 640 // The animation for the second slide should now be completed. |
640 EXPECT_TRUE(slider_delegate.slide_completed()); | 641 EXPECT_TRUE(slider_delegate.slide_completed()); |
641 slider_delegate.Reset(); | 642 slider_delegate.Reset(); |
642 | 643 |
643 window.reset(); | 644 window.reset(); |
644 EXPECT_TRUE(slider_delegate.slider_destroyed()); | 645 EXPECT_TRUE(slider_delegate.slider_destroyed()); |
645 } | 646 } |
646 | 647 |
647 } // namespace content | 648 } // namespace content |
OLD | NEW |