Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1059)

Unified Diff: Source/web/tests/ScrollAnimatorNoneTest.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch LocalFrame::m_pluginElements rep to HashSet<HTMLPlugInElement*> Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/ScrollAnimatorNoneTest.cpp
diff --git a/Source/web/tests/ScrollAnimatorNoneTest.cpp b/Source/web/tests/ScrollAnimatorNoneTest.cpp
index a6a9ac249ffc631aaf1c1426bf6ce9bb8b27fa83..c78b8704f06cf6d41f40261159039955a45d6b93 100644
--- a/Source/web/tests/ScrollAnimatorNoneTest.cpp
+++ b/Source/web/tests/ScrollAnimatorNoneTest.cpp
@@ -80,8 +80,10 @@ private:
class MockScrollAnimatorNone : public ScrollAnimatorNone {
public:
- MockScrollAnimatorNone(ScrollableArea* scrollableArea)
- : ScrollAnimatorNone(scrollableArea) { }
+ static PassRefPtr<MockScrollAnimatorNone> create(ScrollableArea* scrollableArea)
+ {
+ return adoptRef(new MockScrollAnimatorNone(scrollableArea));
+ }
float currentX() { return m_currentPosX; }
float currentY() { return m_currentPosY; }
@@ -107,80 +109,84 @@ public:
}
MOCK_METHOD1(scrollToOffsetWithoutAnimation, void(const FloatPoint&));
+private:
+ explicit MockScrollAnimatorNone(ScrollableArea* scrollableArea)
+ : ScrollAnimatorNone(scrollableArea) { }
+
};
TEST(ScrollAnimatorEnabled, Enabled)
{
MockScrollableArea scrollableArea(true);
- MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea);
+ RefPtr<MockScrollAnimatorNone> scrollAnimatorNone = MockScrollAnimatorNone::create(&scrollableArea);
EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly(Return(1000));
EXPECT_CALL(scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint()));
EXPECT_CALL(scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint(1000, 1000)));
EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4);
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
- EXPECT_NE(100, scrollAnimatorNone.currentX());
- EXPECT_NE(0, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
-
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1);
- EXPECT_NE(100, scrollAnimatorNone.currentX());
- EXPECT_NE(0, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
-
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
- EXPECT_NE(100, scrollAnimatorNone.currentX());
- EXPECT_NE(0, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
-
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPrecisePixel, 4, 25);
- EXPECT_EQ(100, scrollAnimatorNone.currentX());
- EXPECT_NE(0, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
+ EXPECT_NE(100, scrollAnimatorNone->currentX());
+ EXPECT_NE(0, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
+
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPage, 100, 1);
+ EXPECT_NE(100, scrollAnimatorNone->currentX());
+ EXPECT_NE(0, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
+
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
+ EXPECT_NE(100, scrollAnimatorNone->currentX());
+ EXPECT_NE(0, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
+
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPrecisePixel, 4, 25);
+ EXPECT_EQ(100, scrollAnimatorNone->currentX());
+ EXPECT_NE(0, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
}
TEST(ScrollAnimatorEnabled, Disabled)
{
MockScrollableArea scrollableArea(false);
- MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea);
+ RefPtr<MockScrollAnimatorNone> scrollAnimatorNone = MockScrollAnimatorNone::create(&scrollableArea);
EXPECT_CALL(scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint()));
EXPECT_CALL(scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint(1000, 1000)));
EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4);
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
- EXPECT_EQ(100, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
-
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPage, 100, 1);
- EXPECT_EQ(100, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
-
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByDocument, 100, 1);
- EXPECT_EQ(100, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
-
- scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixel, 100, 1);
- EXPECT_EQ(100, scrollAnimatorNone.currentX());
- EXPECT_EQ(0, scrollAnimatorNone.currentY());
- scrollAnimatorNone.reset();
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
+ EXPECT_EQ(100, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
+
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPage, 100, 1);
+ EXPECT_EQ(100, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
+
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByDocument, 100, 1);
+ EXPECT_EQ(100, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
+
+ scrollAnimatorNone->scroll(HorizontalScrollbar, ScrollByPixel, 100, 1);
+ EXPECT_EQ(100, scrollAnimatorNone->currentX());
+ EXPECT_EQ(0, scrollAnimatorNone->currentY());
+ scrollAnimatorNone->reset();
}
class ScrollAnimatorNoneTest : public testing::Test {
public:
struct SavePerAxisData : public ScrollAnimatorNone::PerAxisData {
SavePerAxisData(const ScrollAnimatorNone::PerAxisData& data)
- : ScrollAnimatorNone::PerAxisData(&m_mockScrollAnimatorNone, 0, 768)
+ : ScrollAnimatorNone::PerAxisData(m_mockScrollAnimatorNone.get(), 0, 768)
Nico 2014/10/13 15:41:13 clang/win bot says: ..\..\third_party\WebKit\Sour
, m_mockScrollableArea(true)
- , m_mockScrollAnimatorNone(&m_mockScrollableArea)
+ , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScrollableArea))
{
this->m_currentVelocity = data.m_currentVelocity;
this->m_desiredPosition = data.m_desiredPosition;
@@ -203,19 +209,19 @@ public:
return m_currentVelocity == other.m_currentVelocity && m_desiredPosition == other.m_desiredPosition && m_desiredVelocity == other.m_desiredVelocity && m_startPosition == other.m_startPosition && m_startTime == other.m_startTime && m_startVelocity == other.m_startVelocity && m_animationTime == other.m_animationTime && m_lastAnimationTime == other.m_lastAnimationTime && m_attackPosition == other.m_attackPosition && m_attackTime == other.m_attackTime && m_attackCurve == other.m_attackCurve && m_releasePosition == other.m_releasePosition && m_releaseTime == other.m_releaseTime && m_releaseCurve == other.m_releaseCurve;
}
MockScrollableArea m_mockScrollableArea;
- MockScrollAnimatorNone m_mockScrollAnimatorNone;
+ RefPtr<MockScrollAnimatorNone> m_mockScrollAnimatorNone;
};
ScrollAnimatorNoneTest()
: m_mockScrollableArea(true)
- , m_mockScrollAnimatorNone(&m_mockScrollableArea)
+ , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScrollableArea))
{
}
virtual void SetUp()
{
m_currentPosition = 100;
- m_data = new ScrollAnimatorNone::PerAxisData(&m_mockScrollAnimatorNone, &m_currentPosition, 768);
+ m_data = new ScrollAnimatorNone::PerAxisData(m_mockScrollAnimatorNone.get(), &m_currentPosition, 768);
}
virtual void TearDown()
{
@@ -244,7 +250,7 @@ public:
static double kEndTime;
float m_currentPosition;
MockScrollableArea m_mockScrollableArea;
- MockScrollAnimatorNone m_mockScrollAnimatorNone;
+ RefPtr<MockScrollAnimatorNone> m_mockScrollAnimatorNone;
bool m_scrollingDown;
ScrollAnimatorNone::PerAxisData* m_data;
};
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698