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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: fix some tests; needs rebase; Created 7 years, 6 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
Index: cc/trees/layer_tree_host_unittest_animation.cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 29cc4f44ff52e86f80aa2695384adff12b24af7e..0a9d49e4766fb4a349e8c058380fa667d4165ad1 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -264,18 +264,18 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
PostAddAnimationToMainThread(layer_tree_host()->root_layer());
}
+ virtual void DidCommit() OVERRIDE {
+ layer_tree_host()->SetVisible(false);
+ }
+
// Use WillAnimateLayers to set visible false before the animation runs and
// causes a commit, so we block the second visible animate in single-thread
// mode.
virtual void WillAnimateLayers(
LayerTreeHostImpl* host_impl,
base::TimeTicks monotonic_time) OVERRIDE {
- if (num_animates_ < 2) {
- if (!num_animates_) {
- // We have a long animation running. It should continue to tick even
- // if we are not visible.
- PostSetVisibleToMainThread(false);
- }
+ TRACE_EVENT0("cc", __PRETTY_FUNCTION__);
+ if (num_animates_ < 3) {
num_animates_++;
return;
}
@@ -311,6 +311,8 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
virtual void AnimateLayers(
LayerTreeHostImpl* host_impl,
base::TimeTicks monotonic_time) OVERRIDE {
+ if (!layer_tree_host()->root_layer())
+ return;
LayerAnimationController* controller =
layer_tree_host()->root_layer()->children()[0]->
layer_animation_controller();
@@ -331,6 +333,8 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
// because of the default ease timing function.
EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time));
+ if (!host_impl->active_tree()->root_layer())
+ return;
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
@@ -357,7 +361,8 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
: public LayerTreeHostAnimationTest {
public:
LayerTreeHostAnimationTestSynchronizeAnimationStartTimes()
- : main_start_time_(-1.0),
+ : test_is_setup_(false),
+ main_start_time_(-1.0),
impl_start_time_(-1.0) {}
virtual void SetupTree() OVERRIDE {
@@ -366,6 +371,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
content_->SetBounds(gfx::Size(4, 4));
content_->set_layer_animation_delegate(this);
layer_tree_host()->root_layer()->AddChild(content_);
+ test_is_setup_ = true;
}
virtual void BeginTest() OVERRIDE {
@@ -388,6 +394,9 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
virtual void UpdateAnimationState(
LayerTreeHostImpl* impl_host,
bool has_unfinished_animation) OVERRIDE {
+ if (!test_is_setup_ || !impl_host->active_tree()->root_layer())
+ return;
+
LayerAnimationController* controller =
impl_host->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
@@ -408,6 +417,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
}
private:
+ bool test_is_setup_;
double main_start_time_;
double impl_start_time_;
FakeContentLayerClient client_;

Powered by Google App Engine
This is Rietveld 408576698