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

Unified Diff: cc/layer_tree_host_unittest.cc

Issue 11362054: Use message passing for BeginFrameAndCommitState and clean up forced commit logic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows signed/unsigned warning Created 8 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 | « cc/layer_tree_host.cc ('k') | cc/scheduler.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 4fa8fc774107dbbf574f50faf9e4ac0f95f81731..e5729d0139f7eafbcd94d08b9c96e4d3990c81dc 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -313,8 +313,8 @@ public:
// Make the viewport empty so the host says it can't draw.
m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0));
- scoped_array<char> pixels(new char[4]);
- m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), gfx::Rect(0, 0, 1, 1));
+ char pixels[4];
+ m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1));
} else if (m_numCommits == 2) {
m_layerTreeHost->setNeedsRedraw();
m_layerTreeHost->setNeedsCommit();
@@ -438,8 +438,8 @@ public:
m_layerTreeHost->setVisible(false);
m_layerTreeHost->setNeedsCommit();
m_layerTreeHost->setNeedsCommit();
- scoped_array<char> pixels(new char[4]);
- m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), gfx::Rect(0, 0, 1, 1));
+ char pixels[4];
+ m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1));
} else
endTest();
@@ -2470,8 +2470,8 @@ public:
{
Layer* rootLayer = m_layerTreeHost->rootLayer();
- scoped_array<char> pixels(new char[4]);
- m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), gfx::Rect(0, 0, 1, 1));
+ char pixels[4];
+ m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1));
EXPECT_FALSE(rootLayer->renderSurface());
endTest();
@@ -2484,6 +2484,48 @@ public:
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackCleanup)
+class LayerTreeHostTestCompositeAndReadbackAnimateCount : public LayerTreeHostTest {
+public:
+ LayerTreeHostTestCompositeAndReadbackAnimateCount()
+ : m_layoutCount(0)
+ {
+ }
+
+ virtual void animate(base::TimeTicks) OVERRIDE
+ {
+ // We shouldn't animate on the compositeAndReadback-forced commit, but we should
+ // for the setNeedsCommit-triggered commit.
+ EXPECT_EQ(1, m_layoutCount);
+ }
+
+ virtual void layout() OVERRIDE
+ {
+ m_layoutCount++;
+ if (m_layoutCount == 2)
+ endTest();
+ }
+
+ virtual void beginTest() OVERRIDE
+ {
+ m_layerTreeHost->setNeedsCommit();
+
+ char pixels[4];
+ m_layerTreeHost->compositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1));
+ }
+
+ virtual void afterTest() OVERRIDE
+ {
+ }
+
+private:
+ int m_layoutCount;
+};
+
+TEST_F(LayerTreeHostTestCompositeAndReadbackAnimateCount, runMultiThread)
+{
+ runTest(true);
+}
+
class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit : public LayerTreeHostTest {
public:
LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit()
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698