OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
6 #include "platform/scroll/ScrollableArea.h" | 6 #include "platform/scroll/ScrollableArea.h" |
7 | 7 |
8 #include "platform/testing/TestingPlatformSupport.h" | 8 #include "platform/TestingPlatformSupport.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 #include "public/platform/WebScheduler.h" | 10 #include "public/platform/WebScheduler.h" |
11 #include "public/platform/WebThread.h" | 11 #include "public/platform/WebThread.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 WebScheduler* scheduler() const override | 79 WebScheduler* scheduler() const override |
80 { | 80 { |
81 return nullptr; | 81 return nullptr; |
82 } | 82 } |
83 }; | 83 }; |
84 | 84 |
85 // The FakePlatform is needed because ScrollAnimatorMac's constructor creates se
veral timers. | 85 // The FakePlatform is needed because ScrollAnimatorMac's constructor creates se
veral timers. |
86 // We need just enough scaffolding for the Timer constructor to not segfault. | 86 // We need just enough scaffolding for the Timer constructor to not segfault. |
87 class FakePlatform : public TestingPlatformSupport { | 87 class FakePlatform : public TestingPlatformSupport { |
88 public: | 88 public: |
89 FakePlatform() { } | 89 FakePlatform() : TestingPlatformSupport(TestingPlatformSupport::Config()) {
} |
90 ~FakePlatform() override { } | 90 ~FakePlatform() override { } |
91 | 91 |
92 WebThread* currentThread() override | 92 WebThread* currentThread() override |
93 { | 93 { |
94 return &m_webThread; | 94 return &m_webThread; |
95 } | 95 } |
96 | 96 |
97 private: | 97 private: |
98 FakeWebThread m_webThread; | 98 FakeWebThread m_webThread; |
99 }; | 99 }; |
(...skipping 21 matching lines...) Expand all Loading... |
121 }; | 121 }; |
122 | 122 |
123 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) | 123 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) |
124 { | 124 { |
125 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::
create(IntPoint(0, 100)); | 125 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::
create(IntPoint(0, 100)); |
126 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll); | 126 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll); |
127 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); | 127 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); |
128 } | 128 } |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |