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

Unified Diff: cc/layer_tree_host_unittest.cc

Issue 11017044: Remove root layer specialness in calculateDrawTransforms (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added assertion that rounding does not affect exact coverage testing Created 8 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 | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/test/layer_test_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_unittest.cc
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 030ee97b14bd78738bdbbd66878d340eb59ff3f2..1a9bdb8020b596d4e381ed6f49a13e43d9a36a49 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -651,7 +651,7 @@ public:
virtual void beginTest() OVERRIDE
{
- postAddAnimationToMainThread();
+ postAddAnimationToMainThread(m_layerTreeHost->rootLayer());
}
virtual void afterTest() OVERRIDE
@@ -694,7 +694,7 @@ public:
virtual void beginTest() OVERRIDE
{
- postAddAnimationToMainThread();
+ postAddAnimationToMainThread(m_layerTreeHost->rootLayer());
}
// Use willAnimateLayers to set visible false before the animation runs and
@@ -732,7 +732,7 @@ public:
virtual void beginTest() OVERRIDE
{
- postAddAnimationToMainThread();
+ postAddAnimationToMainThread(m_layerTreeHost->rootLayer());
}
virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeTicks monotonicTime) OVERRIDE
@@ -761,40 +761,6 @@ private:
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestAddAnimationWithTimingFunction)
-// Ensures that when opacity is being animated, this value does not cause the subtree to be skipped.
-class LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public LayerTreeHostTest {
-public:
- LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity()
- {
- }
-
- virtual void beginTest() OVERRIDE
- {
- m_layerTreeHost->rootLayer()->setDrawOpacity(1);
- m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
- m_layerTreeHost->rootLayer()->setOpacity(0);
- postAddAnimationToMainThread();
- }
-
- virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE
- {
- // If the subtree was skipped when preparing to draw, the layer's draw opacity
- // will not have been updated. It should be set to 0 due to the animation.
- // Without the animation, the layer will be skipped since it has zero opacity.
- EXPECT_EQ(0, m_layerTreeHost->rootLayer()->drawOpacity());
- endTest();
- }
-
- virtual void afterTest() OVERRIDE
- {
- }
-};
-
-TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread)
-{
- runTest(true);
-}
-
// Ensures that main thread animations have their start times synchronized with impl thread animations.
class LayerTreeHostTestSynchronizeAnimationStartTimes : public LayerTreeHostTest {
public:
@@ -805,7 +771,7 @@ public:
virtual void beginTest() OVERRIDE
{
- postAddAnimationToMainThread();
+ postAddAnimationToMainThread(m_layerTreeHost->rootLayer());
}
// This is guaranteed to be called before CCLayerTreeHostImpl::animateLayers.
@@ -1240,6 +1206,48 @@ TEST_F(LayerTreeHostTestOpacityChange, runMultiThread)
runTest(true);
}
+// Ensures that when opacity is being animated, this value does not cause the subtree to be skipped.
+class LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public LayerTreeHostTest {
+public:
+ LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity()
+ : m_testOpacityChangeDelegate(this)
+ , m_updateCheckLayer(ContentLayerWithUpdateTracking::create(&m_testOpacityChangeDelegate))
+ {
+ }
+
+ virtual void beginTest() OVERRIDE
+ {
+ m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_layerTreeHost->rootLayer()->addChild(m_updateCheckLayer);
+ m_updateCheckLayer->setOpacity(0);
+ m_updateCheckLayer->setDrawOpacity(0);
+ postAddAnimationToMainThread(m_updateCheckLayer.get());
+ }
+
+ virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE
+ {
+ endTest();
+ }
+
+ virtual void afterTest() OVERRIDE
+ {
+ // update() should have been called once, proving that the layer was not skipped.
+ EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount());
+
+ // clear m_updateCheckLayer so LayerTreeHost dies.
+ m_updateCheckLayer = NULL;
+ }
+
+private:
+ TestOpacityChangeLayerDelegate m_testOpacityChangeDelegate;
+ scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer;
+};
+
+TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread)
+{
+ runTest(true);
+}
+
class MockContentLayerClient : public ContentLayerClient {
public:
bool drawsContent() const { return true; }
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/test/layer_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698