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/scroll/ScrollbarTheme.h" | |
9 #include "platform/scroll/ScrollbarThemeMock.h" | |
8 #include "platform/testing/TestingPlatformSupport.h" | 10 #include "platform/testing/TestingPlatformSupport.h" |
9 #include "public/platform/Platform.h" | 11 #include "public/platform/Platform.h" |
10 #include "public/platform/WebScheduler.h" | 12 #include "public/platform/WebScheduler.h" |
11 #include "public/platform/WebThread.h" | 13 #include "public/platform/WebThread.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
14 | 16 |
15 namespace blink { | 17 namespace blink { |
16 | 18 |
17 namespace { | 19 namespace { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 Platform* m_oldPlatform; // Not owned. | 122 Platform* m_oldPlatform; // Not owned. |
121 }; | 123 }; |
122 | 124 |
123 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) | 125 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) |
124 { | 126 { |
125 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100)); | 127 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100)); |
126 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll); | 128 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll); |
127 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); | 129 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); |
128 } | 130 } |
129 | 131 |
132 TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint) | |
chrishtr
2015/11/24 21:15:12
This doesn't test the mac code...
ccameron
2015/11/25 00:23:02
You're referring to ScrollAnimatorMac? I put quite
| |
133 { | |
134 ScrollbarTheme::setMockScrollbarsEnabled(true); | |
135 ScrollbarThemeMock::setShouldRepaintAllPartsOnInvalidation(true); | |
136 | |
137 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100)); | |
138 RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.g et(), HorizontalScrollbar, RegularScrollbar); | |
139 | |
140 EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint()); | |
141 EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); | |
142 scrollbar->setNeedsPaintInvalidation(); | |
143 EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint()); | |
144 EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); | |
145 | |
146 scrollbar->setTrackBackgroundNeedsRepaint(false); | |
147 scrollbar->setThumbNeedsRepaint(false); | |
148 EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint()); | |
149 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); | |
150 scrollbar->setNeedsPaintInvalidation(); | |
151 EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint()); | |
152 EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); | |
153 | |
154 ScrollbarThemeMock::setShouldRepaintAllPartsOnInvalidation(false); | |
155 scrollbar->setTrackBackgroundNeedsRepaint(false); | |
156 scrollbar->setThumbNeedsRepaint(false); | |
157 EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint()); | |
158 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); | |
159 scrollbar->setNeedsPaintInvalidation(); | |
160 EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint()); | |
161 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); | |
162 } | |
163 | |
130 } // namespace blink | 164 } // namespace blink |
OLD | NEW |