OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 // Idle | 207 // Idle |
208 scrollAnimator->updateCompositorAnimations(); | 208 scrollAnimator->updateCompositorAnimations(); |
209 scrollAnimator->tickAnimation(getMockedTime()); | 209 scrollAnimator->tickAnimation(getMockedTime()); |
210 EXPECT_EQ(scrollAnimator->m_runState, | 210 EXPECT_EQ(scrollAnimator->m_runState, |
211 ScrollAnimatorCompositorCoordinator::RunState::Idle); | 211 ScrollAnimatorCompositorCoordinator::RunState::Idle); |
212 | 212 |
213 reset(*scrollAnimator); | 213 reset(*scrollAnimator); |
214 | 214 |
215 // Forced GC in order to finalize objects depending on the mock object. | 215 // Forced GC in order to finalize objects depending on the mock object. |
216 ThreadState::current()-> collectAllGarbage(); | 216 ThreadHeap::collectAllGarbage(); |
217 } | 217 } |
218 | 218 |
219 TEST(ScrollAnimatorTest, MainThreadEnabled) | 219 TEST(ScrollAnimatorTest, MainThreadEnabled) |
220 { | 220 { |
221 MockScrollableArea* scrollableArea = MockScrollableArea::create(true); | 221 MockScrollableArea* scrollableArea = MockScrollableArea::create(true); |
222 ScrollAnimator* scrollAnimator = new ScrollAnimator(scrollableArea, getMocke
dTime); | 222 ScrollAnimator* scrollAnimator = new ScrollAnimator(scrollableArea, getMocke
dTime); |
223 | 223 |
224 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint())); | 224 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint())); |
225 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint(1000, 1000))); | 225 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint(1000, 1000))); |
226 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(9); | 226 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(9); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService()); | 546 EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService()); |
547 EXPECT_TRUE(result.didScrollX); | 547 EXPECT_TRUE(result.didScrollX); |
548 EXPECT_FLOAT_EQ(0.0, result.unusedScrollDeltaX); | 548 EXPECT_FLOAT_EQ(0.0, result.unusedScrollDeltaX); |
549 EXPECT_EQ(scrollAnimator->m_runState, | 549 EXPECT_EQ(scrollAnimator->m_runState, |
550 ScrollAnimatorCompositorCoordinator::RunState::RunningOnCompositorButNee
dsUpdate); | 550 ScrollAnimatorCompositorCoordinator::RunState::RunningOnCompositorButNee
dsUpdate); |
551 EXPECT_EQ(250, scrollAnimator->desiredTargetPosition().x()); | 551 EXPECT_EQ(250, scrollAnimator->desiredTargetPosition().x()); |
552 EXPECT_EQ(0, scrollAnimator->desiredTargetPosition().y()); | 552 EXPECT_EQ(0, scrollAnimator->desiredTargetPosition().y()); |
553 reset(*scrollAnimator); | 553 reset(*scrollAnimator); |
554 | 554 |
555 // Forced GC in order to finalize objects depending on the mock object. | 555 // Forced GC in order to finalize objects depending on the mock object. |
556 ThreadState::current()-> collectAllGarbage(); | 556 ThreadHeap::collectAllGarbage(); |
557 } | 557 } |
558 | 558 |
559 // This test verifies that impl only animation updates get cleared once they | 559 // This test verifies that impl only animation updates get cleared once they |
560 // are pushed to compositor animation host. | 560 // are pushed to compositor animation host. |
561 TEST(ScrollAnimatorTest, ImplOnlyAnimationUpdatesCleared) | 561 TEST(ScrollAnimatorTest, ImplOnlyAnimationUpdatesCleared) |
562 { | 562 { |
563 MockScrollableArea* scrollableArea = MockScrollableArea::create(true); | 563 MockScrollableArea* scrollableArea = MockScrollableArea::create(true); |
564 TestScrollAnimator* animator = new TestScrollAnimator(scrollableArea, getMoc
kedTime); | 564 TestScrollAnimator* animator = new TestScrollAnimator(scrollableArea, getMoc
kedTime); |
565 | 565 |
566 // From calls to adjust/takeoverImplOnlyScrollOffsetAnimation. | 566 // From calls to adjust/takeoverImplOnlyScrollOffsetAnimation. |
(...skipping 14 matching lines...) Expand all Loading... |
581 | 581 |
582 EXPECT_EQ(animator->m_runState, ScrollAnimatorCompositorCoordinator::RunStat
e::Idle); | 582 EXPECT_EQ(animator->m_runState, ScrollAnimatorCompositorCoordinator::RunStat
e::Idle); |
583 EXPECT_FALSE(animator->hasAnimationThatRequiresService()); | 583 EXPECT_FALSE(animator->hasAnimationThatRequiresService()); |
584 EXPECT_TRUE(animator->implOnlyAnimationAdjustmentForTesting().isZero()); | 584 EXPECT_TRUE(animator->implOnlyAnimationAdjustmentForTesting().isZero()); |
585 | 585 |
586 // Verify that the takeover update is cleared. | 586 // Verify that the takeover update is cleared. |
587 animator->takeOverImplOnlyScrollOffsetAnimation(); | 587 animator->takeOverImplOnlyScrollOffsetAnimation(); |
588 EXPECT_FALSE(animator->hasAnimationThatRequiresService()); | 588 EXPECT_FALSE(animator->hasAnimationThatRequiresService()); |
589 | 589 |
590 // Forced GC in order to finalize objects depending on the mock object. | 590 // Forced GC in order to finalize objects depending on the mock object. |
591 ThreadState::current()-> collectAllGarbage(); | 591 ThreadHeap::collectAllGarbage(); |
592 } | 592 } |
593 | 593 |
594 TEST(ScrollAnimatorTest, MainThreadAnimationTargetAdjustment) | 594 TEST(ScrollAnimatorTest, MainThreadAnimationTargetAdjustment) |
595 { | 595 { |
596 MockScrollableArea* scrollableArea = MockScrollableArea::create(true); | 596 MockScrollableArea* scrollableArea = MockScrollableArea::create(true); |
597 ScrollAnimator* animator = new ScrollAnimator(scrollableArea, getMockedTime)
; | 597 ScrollAnimator* animator = new ScrollAnimator(scrollableArea, getMockedTime)
; |
598 scrollableArea->setScrollAnimator(animator); | 598 scrollableArea->setScrollAnimator(animator); |
599 | 599 |
600 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)) | 600 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)) |
601 .WillRepeatedly(Return(IntPoint(-100, -100))); | 601 .WillRepeatedly(Return(IntPoint(-100, -100))); |
(...skipping 29 matching lines...) Expand all Loading... |
631 EXPECT_EQ(FloatPoint(110, 90), animator->desiredTargetPosition()); | 631 EXPECT_EQ(FloatPoint(110, 90), animator->desiredTargetPosition()); |
632 | 632 |
633 // Animation finished | 633 // Animation finished |
634 gMockedTime += 1.0; | 634 gMockedTime += 1.0; |
635 animator->updateCompositorAnimations(); | 635 animator->updateCompositorAnimations(); |
636 animator->tickAnimation(getMockedTime()); | 636 animator->tickAnimation(getMockedTime()); |
637 EXPECT_EQ(FloatPoint(110, 90), animator->currentPosition()); | 637 EXPECT_EQ(FloatPoint(110, 90), animator->currentPosition()); |
638 reset(*animator); | 638 reset(*animator); |
639 | 639 |
640 // Forced GC in order to finalize objects depending on the mock object. | 640 // Forced GC in order to finalize objects depending on the mock object. |
641 ThreadState::current()-> collectAllGarbage(); | 641 ThreadHeap::collectAllGarbage(); |
642 } | 642 } |
643 | 643 |
644 } // namespace blink | 644 } // namespace blink |
OLD | NEW |