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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 19106007: cc: Allow the main thread to cancel commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix scheduler tests Created 7 years, 5 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 fa4b88632b366eb61b42e1ec4be1cec63d25e3c9..171c155576f3f21586e43e211bb375148fa7f9ac 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -18,9 +18,32 @@
namespace cc {
namespace {
+class AlwaysUpdateLayer : public Layer {
+ public:
+ static scoped_refptr<AlwaysUpdateLayer> Create() {
+ return new AlwaysUpdateLayer();
+ }
+
+ virtual bool DrawsContent() const OVERRIDE { return true; }
+ virtual bool Update(ResourceUpdateQueue* queue,
+ const OcclusionTracker* occlusion) OVERRIDE {
+ return true;
danakj 2013/07/17 20:53:24 Why do you need update to force commit for these t
enne (OOO) 2013/07/18 17:36:37 Thanks for calling this out. I dug into this furt
+ }
+
+ private:
+ AlwaysUpdateLayer() {}
+ virtual ~AlwaysUpdateLayer() {}
+};
+
class LayerTreeHostAnimationTest : public LayerTreeTest {
public:
virtual void SetupTree() OVERRIDE {
+ scoped_refptr<AlwaysUpdateLayer> root_layer = AlwaysUpdateLayer::Create();
+ root_layer->SetBounds(gfx::Size(1, 1));
+ root_layer->SetIsDrawable(true);
+ root_layer->SetScrollable(true);
+ layer_tree_host()->SetRootLayer(root_layer);
+
LayerTreeTest::SetupTree();
layer_tree_host()->root_layer()->set_layer_animation_delegate(this);
}
@@ -445,9 +468,9 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
}
virtual void SetupTree() OVERRIDE {
- update_check_layer_->SetOpacity(0.f);
- layer_tree_host()->SetRootLayer(update_check_layer_);
LayerTreeHostAnimationTest::SetupTree();
+ update_check_layer_->SetOpacity(0.f);
+ layer_tree_host()->root_layer()->AddChild(update_check_layer_);
}
virtual void BeginTest() OVERRIDE {
@@ -455,23 +478,25 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
}
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ LayerImpl* update_check_layer_impl =
+ host_impl->active_tree()->LayerById(update_check_layer_->id());
LayerAnimationController* controller_impl =
- host_impl->active_tree()->root_layer()->layer_animation_controller();
+ update_check_layer_impl->layer_animation_controller();
Animation* animation_impl =
controller_impl->GetAnimation(Animation::Opacity);
controller_impl->RemoveAnimation(animation_impl->id());
EndTest();
}
- virtual void AfterTest() OVERRIDE {
+ virtual void DidCommit() OVERRIDE {
// Update() should have been called once, proving that the layer was not
// skipped.
EXPECT_EQ(1u, update_check_layer_->update_count());
-
- // clear update_check_layer_ so LayerTreeHost dies.
- update_check_layer_ = NULL;
+ update_check_layer_->reset_update_count();
danakj 2013/07/17 20:53:24 Are you seeing more updates now than we were befor
enne (OOO) 2013/07/18 17:36:37 Yeah, this was the result of ignoring the ignore s
}
+ virtual void AfterTest() OVERRIDE {}
+
private:
FakeContentLayerClient client_;
scoped_refptr<FakeContentLayer> update_check_layer_;

Powered by Google App Engine
This is Rietveld 408576698