| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 using testing::Return; | 45 using testing::Return; |
| 46 using testing::_; | 46 using testing::_; |
| 47 | 47 |
| 48 class MockScrollableArea : public ScrollableArea { | 48 class MockScrollableArea : public ScrollableArea { |
| 49 public: | 49 public: |
| 50 MockScrollableArea(bool scrollAnimatorEnabled) | 50 MockScrollableArea(bool scrollAnimatorEnabled) |
| 51 : m_scrollAnimatorEnabled(scrollAnimatorEnabled) { } | 51 : m_scrollAnimatorEnabled(scrollAnimatorEnabled) { } |
| 52 | 52 |
| 53 MOCK_CONST_METHOD0(isActive, bool()); | 53 MOCK_CONST_METHOD0(isActive, bool()); |
| 54 MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation)); | 54 MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation)); |
| 55 MOCK_CONST_METHOD1(scrollPosition, int(Scrollbar*)); | |
| 56 MOCK_METHOD2(invalidateScrollbar, void(Scrollbar*, const IntRect&)); | 55 MOCK_METHOD2(invalidateScrollbar, void(Scrollbar*, const IntRect&)); |
| 57 MOCK_CONST_METHOD0(isScrollCornerVisible, bool()); | 56 MOCK_CONST_METHOD0(isScrollCornerVisible, bool()); |
| 58 MOCK_CONST_METHOD0(scrollCornerRect, IntRect()); | 57 MOCK_CONST_METHOD0(scrollCornerRect, IntRect()); |
| 59 MOCK_METHOD1(setScrollOffset, void(const IntPoint&)); | 58 MOCK_METHOD1(setScrollOffset, void(const IntPoint&)); |
| 60 MOCK_METHOD2(invalidateScrollbarRect, void(Scrollbar*, const IntRect&)); | 59 MOCK_METHOD2(invalidateScrollbarRect, void(Scrollbar*, const IntRect&)); |
| 61 MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&)); | 60 MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&)); |
| 62 MOCK_METHOD1(setScrollOffsetFromAnimation, void(const IntPoint&)); | 61 MOCK_METHOD1(setScrollOffsetFromAnimation, void(const IntPoint&)); |
| 63 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); | 62 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); |
| 64 MOCK_CONST_METHOD0(minimumScrollPosition, IntPoint()); | 63 MOCK_CONST_METHOD0(minimumScrollPosition, IntPoint()); |
| 65 MOCK_CONST_METHOD0(maximumScrollPosition, IntPoint()); | 64 MOCK_CONST_METHOD0(maximumScrollPosition, IntPoint()); |
| 66 MOCK_CONST_METHOD1(visibleContentRect, IntRect(VisibleContentRectIncludesScr
ollbars)); | 65 MOCK_CONST_METHOD1(visibleContentRect, IntRect(VisibleContentRectIncludesScr
ollbars)); |
| 67 MOCK_CONST_METHOD0(contentsSize, IntSize()); | 66 MOCK_CONST_METHOD0(contentsSize, IntSize()); |
| 68 MOCK_CONST_METHOD0(overhangAmount, IntSize()); | 67 MOCK_CONST_METHOD0(overhangAmount, IntSize()); |
| 69 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool()); | 68 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool()); |
| 70 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect()); | 69 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect()); |
| 71 | 70 |
| 71 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE { retu
rn true; } |
| 72 virtual IntPoint scrollPosition() const OVERRIDE { return IntPoint(); } | 72 virtual IntPoint scrollPosition() const OVERRIDE { return IntPoint(); } |
| 73 virtual int visibleHeight() const OVERRIDE { return 768; } | 73 virtual int visibleHeight() const OVERRIDE { return 768; } |
| 74 virtual int visibleWidth() const OVERRIDE { return 1024; } | 74 virtual int visibleWidth() const OVERRIDE { return 1024; } |
| 75 virtual bool scrollAnimatorEnabled() const OVERRIDE { return m_scrollAnimato
rEnabled; } | 75 virtual bool scrollAnimatorEnabled() const OVERRIDE { return m_scrollAnimato
rEnabled; } |
| 76 virtual int pageStep(ScrollbarOrientation) const OVERRIDE { return 0; } |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 bool m_scrollAnimatorEnabled; | 79 bool m_scrollAnimatorEnabled; |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 class MockScrollAnimatorNone : public ScrollAnimatorNone { | 82 class MockScrollAnimatorNone : public ScrollAnimatorNone { |
| 82 public: | 83 public: |
| 83 MockScrollAnimatorNone() | 84 MockScrollAnimatorNone() |
| 84 : ScrollAnimatorNone(new MockScrollableArea(true)) { } | 85 : ScrollAnimatorNone(new MockScrollableArea(true)) { } |
| 85 MockScrollAnimatorNone(ScrollableArea* scrollableArea) | 86 MockScrollAnimatorNone(ScrollableArea* scrollableArea) |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 EXPECT_TRUE(result); | 1040 EXPECT_TRUE(result); |
| 1040 result = result && animateScroll(t); | 1041 result = result && animateScroll(t); |
| 1041 double after = m_currentPosition; | 1042 double after = m_currentPosition; |
| 1042 EXPECT_GE(before, after); | 1043 EXPECT_GE(before, after); |
| 1043 | 1044 |
| 1044 t += kAnimationTime; | 1045 t += kAnimationTime; |
| 1045 for (; result && t < kEndTime; t += kAnimationTime) | 1046 for (; result && t < kEndTime; t += kAnimationTime) |
| 1046 result = result && animateScroll(t); | 1047 result = result && animateScroll(t); |
| 1047 EXPECT_GE(before, m_currentPosition); | 1048 EXPECT_GE(before, m_currentPosition); |
| 1048 } | 1049 } |
| OLD | NEW |