Chromium Code Reviews| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 110 |
| 111 MOCK_METHOD1(scrollToOffsetWithoutAnimation, void(const FloatPoint&)); | 111 MOCK_METHOD1(scrollToOffsetWithoutAnimation, void(const FloatPoint&)); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 TEST(ScrollAnimatorEnabled, Enabled) | 114 TEST(ScrollAnimatorEnabled, Enabled) |
| 115 { | 115 { |
| 116 MockScrollableArea scrollableArea(true); | 116 MockScrollableArea scrollableArea(true); |
| 117 MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea); | 117 MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea); |
| 118 | 118 |
| 119 EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly( Return(1000)); | 119 EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly( Return(1000)); |
| 120 EXPECT_CALL(scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).WillR epeatedly(Return(IntPoint())); | |
| 121 EXPECT_CALL(scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).WillR epeatedly(Return(IntPoint(1000, 1000))); | |
| 120 EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4); | 122 EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4); |
| 121 | 123 |
| 122 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1); | 124 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1); |
| 123 EXPECT_NE(100, scrollAnimatorNone.currentX()); | 125 EXPECT_NE(100, scrollAnimatorNone.currentX()); |
| 124 EXPECT_NE(0, scrollAnimatorNone.currentX()); | 126 EXPECT_NE(0, scrollAnimatorNone.currentX()); |
| 125 EXPECT_EQ(0, scrollAnimatorNone.currentY()); | 127 EXPECT_EQ(0, scrollAnimatorNone.currentY()); |
| 126 scrollAnimatorNone.reset(); | 128 scrollAnimatorNone.reset(); |
| 127 | 129 |
| 128 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1); | 130 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1); |
| 129 EXPECT_NE(100, scrollAnimatorNone.currentX()); | 131 EXPECT_NE(100, scrollAnimatorNone.currentX()); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 142 EXPECT_NE(0, scrollAnimatorNone.currentX()); | 144 EXPECT_NE(0, scrollAnimatorNone.currentX()); |
| 143 EXPECT_EQ(0, scrollAnimatorNone.currentY()); | 145 EXPECT_EQ(0, scrollAnimatorNone.currentY()); |
| 144 scrollAnimatorNone.reset(); | 146 scrollAnimatorNone.reset(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 TEST(ScrollAnimatorEnabled, Disabled) | 149 TEST(ScrollAnimatorEnabled, Disabled) |
| 148 { | 150 { |
| 149 MockScrollableArea scrollableArea(false); | 151 MockScrollableArea scrollableArea(false); |
| 150 MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea); | 152 MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea); |
| 151 | 153 |
| 152 EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly( Return(1000)); | 154 // EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedl y(Return(1000)); |
|
jamesr
2013/05/07 03:33:31
delete this line if you don't want it, don't just
| |
| 155 EXPECT_CALL(scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).WillR epeatedly(Return(IntPoint())); | |
| 156 EXPECT_CALL(scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).WillR epeatedly(Return(IntPoint(1000, 1000))); | |
| 153 EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4); | 157 EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4); |
| 154 | 158 |
| 155 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1); | 159 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1); |
| 156 EXPECT_EQ(100, scrollAnimatorNone.currentX()); | 160 EXPECT_EQ(100, scrollAnimatorNone.currentX()); |
| 157 EXPECT_EQ(0, scrollAnimatorNone.currentY()); | 161 EXPECT_EQ(0, scrollAnimatorNone.currentY()); |
| 158 scrollAnimatorNone.reset(); | 162 scrollAnimatorNone.reset(); |
| 159 | 163 |
| 160 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1); | 164 scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1); |
| 161 EXPECT_EQ(100, scrollAnimatorNone.currentX()); | 165 EXPECT_EQ(100, scrollAnimatorNone.currentX()); |
| 162 EXPECT_EQ(0, scrollAnimatorNone.currentY()); | 166 EXPECT_EQ(0, scrollAnimatorNone.currentY()); |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1036 EXPECT_TRUE(result); | 1040 EXPECT_TRUE(result); |
| 1037 result = result && animateScroll(t); | 1041 result = result && animateScroll(t); |
| 1038 double after = m_currentPosition; | 1042 double after = m_currentPosition; |
| 1039 EXPECT_GE(before, after); | 1043 EXPECT_GE(before, after); |
| 1040 | 1044 |
| 1041 t += kAnimationTime; | 1045 t += kAnimationTime; |
| 1042 for (; result && t < kEndTime; t += kAnimationTime) | 1046 for (; result && t < kEndTime; t += kAnimationTime) |
| 1043 result = result && animateScroll(t); | 1047 result = result && animateScroll(t); |
| 1044 EXPECT_GE(before, m_currentPosition); | 1048 EXPECT_GE(before, m_currentPosition); |
| 1045 } | 1049 } |
| OLD | NEW |