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() |