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

Unified Diff: third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp

Issue 1452613002: KeyframeEffectTest: avoid keeping unnecessary Document reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
index ae1413e4a4ed0b74c7e5cace3dd91a93dd961b68..938f5c3bcedd6d872fbc5230cc260c6e0b1eafbe 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
@@ -27,16 +27,17 @@ class KeyframeEffectTest : public ::testing::Test {
protected:
KeyframeEffectTest()
: pageHolder(DummyPageHolder::create())
- , document(pageHolder->document())
- , element(document.createElement("foo", ASSERT_NO_EXCEPTION))
{
- document.animationClock().resetTimeForTesting(document.timeline().zeroTime());
- document.documentElement()->appendChild(element.get());
- EXPECT_EQ(0, document.timeline().currentTime());
+ element = document().createElement("foo", ASSERT_NO_EXCEPTION);
+
+ document().animationClock().resetTimeForTesting(document().timeline().zeroTime());
+ document().documentElement()->appendChild(element.get());
+ EXPECT_EQ(0, document().timeline().currentTime());
}
+ Document& document() const { return pageHolder->document(); }
+
OwnPtr<DummyPageHolder> pageHolder;
- Document& document;
RefPtrWillBePersistent<Element> element;
TrackExceptionState exceptionState;
};
@@ -274,7 +275,7 @@ TEST_F(KeyframeEffectTest, TimeToEffectChange)
timing.endDelay = 100;
timing.fillMode = Timing::FillModeNone;
KeyframeEffect* animation = KeyframeEffect::create(0, nullptr, timing);
- Animation* player = document.timeline().play(animation);
+ Animation* player = document().timeline().play(animation);
double inf = std::numeric_limits<double>::infinity();
EXPECT_EQ(100, animation->timeToForwardsEffectChange());
@@ -307,7 +308,7 @@ TEST_F(KeyframeEffectTest, TimeToEffectChangeWithPlaybackRate)
timing.playbackRate = 2;
timing.fillMode = Timing::FillModeNone;
KeyframeEffect* animation = KeyframeEffect::create(0, nullptr, timing);
- Animation* player = document.timeline().play(animation);
+ Animation* player = document().timeline().play(animation);
double inf = std::numeric_limits<double>::infinity();
EXPECT_EQ(100, animation->timeToForwardsEffectChange());
@@ -340,7 +341,7 @@ TEST_F(KeyframeEffectTest, TimeToEffectChangeWithNegativePlaybackRate)
timing.playbackRate = -2;
timing.fillMode = Timing::FillModeNone;
KeyframeEffect* animation = KeyframeEffect::create(0, nullptr, timing);
- Animation* player = document.timeline().play(animation);
+ Animation* player = document().timeline().play(animation);
double inf = std::numeric_limits<double>::infinity();
EXPECT_EQ(100, animation->timeToForwardsEffectChange());
@@ -371,7 +372,7 @@ TEST_F(KeyframeEffectTest, ElementDestructorClearsAnimationTarget)
timing.iterationDuration = 5;
KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, timing);
EXPECT_EQ(element.get(), animation->target());
- document.timeline().play(animation);
+ document().timeline().play(animation);
pageHolder.clear();
element.clear();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698