| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 TEST(ScrollAnimatorTest, MainThreadEnabled) | 104 TEST(ScrollAnimatorTest, MainThreadEnabled) |
| 105 { | 105 { |
| 106 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::
create(true); | 106 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::
create(true); |
| 107 OwnPtrWillBeRawPtr<ScrollAnimator> scrollAnimator = adoptPtrWillBeNoop(new S
crollAnimator(scrollableArea.get(), getMockedTime)); | 107 OwnPtrWillBeRawPtr<ScrollAnimator> scrollAnimator = adoptPtrWillBeNoop(new S
crollAnimator(scrollableArea.get(), getMockedTime)); |
| 108 | 108 |
| 109 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint())); | 109 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint())); |
| 110 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint(1000, 1000))); | 110 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).Will
Repeatedly(Return(IntPoint(1000, 1000))); |
| 111 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(9); | 111 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(9); |
| 112 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3); | 112 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(6); |
| 113 EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1)).WillRepe
atedly(Return(true)); | 113 EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1)).WillRepe
atedly(Return(true)); |
| 114 | 114 |
| 115 EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService()); | 115 EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService()); |
| 116 | 116 |
| 117 ScrollResultOneDimensional result = scrollAnimator->userScroll(HorizontalScr
ollbar, ScrollByLine, 100, -1); | 117 ScrollResultOneDimensional result = scrollAnimator->userScroll(HorizontalScr
ollbar, ScrollByLine, 100, -1); |
| 118 EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService()); | 118 EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService()); |
| 119 EXPECT_FALSE(result.didScroll); | 119 EXPECT_FALSE(result.didScroll); |
| 120 EXPECT_FLOAT_EQ(-1.0f, result.unusedScrollDelta); | 120 EXPECT_FLOAT_EQ(-1.0f, result.unusedScrollDelta); |
| 121 | 121 |
| 122 result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100,
1); | 122 result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100,
1); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); | 199 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); |
| 200 reset(*scrollAnimator); | 200 reset(*scrollAnimator); |
| 201 | 201 |
| 202 scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 100, 1); | 202 scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 100, 1); |
| 203 EXPECT_EQ(100, scrollAnimator->currentPosition().x()); | 203 EXPECT_EQ(100, scrollAnimator->currentPosition().x()); |
| 204 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); | 204 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); |
| 205 reset(*scrollAnimator); | 205 reset(*scrollAnimator); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace blink | 208 } // namespace blink |
| OLD | NEW |