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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 1169643002: cc: Make unittests use FakePictureLayer instead of FakeContentLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implsidetests: . Created 5 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
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_copyrequest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6300622773729219ec593cb5e42f208b90f274f7..e6f2b5c224b345453ec7e38ba0d0b33395b3b201 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -12,8 +12,8 @@
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
#include "cc/test/animation_test_common.h"
-#include "cc/test/fake_content_layer.h"
#include "cc/test/fake_content_layer_client.h"
+#include "cc/test/fake_picture_layer.h"
#include "cc/test/layer_tree_test.h"
#include "cc/trees/layer_tree_impl.h"
@@ -231,12 +231,12 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- content_ = FakeContentLayer::Create(layer_settings(), &client_);
- content_->SetBounds(gfx::Size(4, 4));
- layer_tree_host()->root_layer()->AddChild(content_);
+ picture_ = FakePictureLayer::Create(layer_settings(), &client_);
+ picture_->SetBounds(gfx::Size(4, 4));
+ layer_tree_host()->root_layer()->AddChild(picture_);
}
- void BeginTest() override { PostAddAnimationToMainThread(content_.get()); }
+ void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); }
void AnimateLayers(LayerTreeHostImpl* host_impl,
base::TimeTicks monotonic_time) override {
@@ -265,7 +265,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
void AfterTest() override {}
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> content_;
+ scoped_refptr<FakePictureLayer> picture_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -280,13 +280,13 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- content_ = FakeContentLayer::Create(layer_settings(), &client_);
- content_->SetBounds(gfx::Size(4, 4));
- content_->set_layer_animation_delegate(this);
- layer_tree_host()->root_layer()->AddChild(content_);
+ picture_ = FakePictureLayer::Create(layer_settings(), &client_);
+ picture_->SetBounds(gfx::Size(4, 4));
+ picture_->set_layer_animation_delegate(this);
+ layer_tree_host()->root_layer()->AddChild(picture_);
}
- void BeginTest() override { PostAddAnimationToMainThread(content_.get()); }
+ void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); }
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
@@ -321,7 +321,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
base::TimeTicks main_start_time_;
base::TimeTicks impl_start_time_;
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> content_;
+ scoped_refptr<FakePictureLayer> picture_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -361,7 +361,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
public:
LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity()
: update_check_layer_(
- FakeContentLayer::Create(layer_settings(), &client_)) {}
+ FakePictureLayer::Create(layer_settings(), &client_)) {}
void SetupTree() override {
update_check_layer_->SetOpacity(0.f);
@@ -393,7 +393,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
private:
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> update_check_layer_;
+ scoped_refptr<FakePictureLayer> update_check_layer_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -475,8 +475,6 @@ class LayerTreeHostAnimationTestCancelAnimateCommit
int num_begin_frames_;
int num_commit_calls_;
int num_draw_calls_;
- FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> content_;
};
MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit);
@@ -558,15 +556,15 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- content_ = FakeContentLayer::Create(layer_settings(), &client_);
- content_->SetBounds(gfx::Size(4, 4));
- content_->set_layer_animation_delegate(this);
- layer_tree_host()->root_layer()->AddChild(content_);
+ picture_ = FakePictureLayer::Create(layer_settings(), &client_);
+ picture_->SetBounds(gfx::Size(4, 4));
+ picture_->set_layer_animation_delegate(this);
+ layer_tree_host()->root_layer()->AddChild(picture_);
}
void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size());
- PostAddAnimationToMainThread(content_.get());
+ PostAddAnimationToMainThread(picture_.get());
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
@@ -586,7 +584,7 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw
private:
int started_times_;
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> content_;
+ scoped_refptr<FakePictureLayer> picture_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -598,10 +596,10 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
: public LayerTreeHostAnimationTest {
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- content_ = FakeContentLayer::Create(layer_settings(), &client_);
- content_->SetBounds(gfx::Size(4, 4));
- content_->set_layer_animation_delegate(this);
- layer_tree_host()->root_layer()->AddChild(content_);
+ picture_ = FakePictureLayer::Create(layer_settings(), &client_);
+ picture_->SetBounds(gfx::Size(4, 4));
+ picture_->set_layer_animation_delegate(this);
+ layer_tree_host()->root_layer()->AddChild(picture_);
}
void InitializeSettings(LayerTreeSettings* settings) override {
@@ -636,12 +634,12 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
switch (layer_tree_host()->source_frame_number()) {
case 1:
// The animation is longer than 1 BeginFrame interval.
- AddOpacityTransitionToLayer(content_.get(), 0.1, 0.2f, 0.8f, false);
+ AddOpacityTransitionToLayer(picture_.get(), 0.1, 0.2f, 0.8f, false);
added_animations_++;
break;
case 2:
// This second animation will not be drawn so it should not start.
- AddAnimatedTransformToLayer(content_.get(), 0.1, 5, 5);
+ AddAnimatedTransformToLayer(picture_.get(), 0.1, 5, 5);
added_animations_++;
break;
}
@@ -667,7 +665,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
int added_animations_;
int started_times_;
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> content_;
+ scoped_refptr<FakePictureLayer> picture_;
};
MULTI_THREAD_TEST_F(
@@ -684,7 +682,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- scroll_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
+ scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id());
scroll_layer_->SetBounds(gfx::Size(1000, 1000));
scroll_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20));
@@ -722,7 +720,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
private:
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> scroll_layer_;
+ scoped_refptr<FakePictureLayer> scroll_layer_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -741,7 +739,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- scroll_layer_ = FakeContentLayer::Create(layer_settings(), &client_);
+ scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id());
scroll_layer_->SetBounds(gfx::Size(10000, 10000));
scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0));
@@ -836,7 +834,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
private:
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> scroll_layer_;
+ scoped_refptr<FakePictureLayer> scroll_layer_;
const gfx::ScrollOffset final_postion_;
};
@@ -937,10 +935,10 @@ class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- content_ = Layer::Create(layer_settings());
- content_->SetBounds(gfx::Size(4, 4));
- layer_tree_host()->root_layer()->AddChild(content_);
- AddOpacityTransitionToLayer(content_.get(), 10000.0, 0.1f, 0.9f, true);
+ layer_ = Layer::Create(layer_settings());
+ layer_->SetBounds(gfx::Size(4, 4));
+ layer_tree_host()->root_layer()->AddChild(layer_);
+ AddOpacityTransitionToLayer(layer_.get(), 10000.0, 0.1f, 0.9f, true);
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -948,10 +946,10 @@ class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded
void DidCommit() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
- content_->RemoveFromParent();
+ layer_->RemoveFromParent();
break;
case 2:
- layer_tree_host()->root_layer()->AddChild(content_);
+ layer_tree_host()->root_layer()->AddChild(layer_);
break;
}
}
@@ -974,7 +972,7 @@ class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded
void AfterTest() override {}
private:
- scoped_refptr<Layer> content_;
+ scoped_refptr<Layer> layer_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -988,9 +986,9 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- content_ = Layer::Create(layer_settings());
- content_->SetBounds(gfx::Size(4, 4));
- layer_tree_host()->root_layer()->AddChild(content_);
+ layer_ = Layer::Create(layer_settings());
+ layer_->SetBounds(gfx::Size(4, 4));
+ layer_tree_host()->root_layer()->AddChild(layer_);
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -1004,7 +1002,7 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
case 2:
// Second frame: add an animation to the content layer. The root layer
// animation has caused us to animate already during this frame.
- AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false);
+ AddOpacityTransitionToLayer(layer_.get(), 0.1, 5, 5, false);
break;
}
}
@@ -1035,7 +1033,7 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
void AfterTest() override {}
private:
- scoped_refptr<Layer> content_;
+ scoped_refptr<Layer> layer_;
int num_swap_buffers_;
};
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_copyrequest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698