| Index: Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
|
| ===================================================================
|
| --- Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (revision 122257)
|
| +++ Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (working copy)
|
| @@ -485,7 +485,41 @@
|
| runTestThreaded();
|
| }
|
|
|
| +class CCLayerTreeHostTestAbortFrameWhenInvisible : public CCLayerTreeHostTestThreadOnly {
|
| +public:
|
| + CCLayerTreeHostTestAbortFrameWhenInvisible()
|
| + {
|
| + }
|
|
|
| + virtual void beginTest()
|
| + {
|
| + // Request a commit (from the main thread), which will trigger the commit flow from the impl side.
|
| + m_layerTreeHost->setNeedsCommit();
|
| + // Then mark ourselves as not visible before processing any more messages on the main thread.
|
| + m_layerTreeHost->setVisible(false);
|
| + // If we make it without kicking a frame, we pass!
|
| + endTestAfterDelay(1);
|
| + }
|
| +
|
| + virtual void layout() OVERRIDE
|
| + {
|
| + ASSERT_FALSE(true);
|
| + endTest();
|
| + }
|
| +
|
| + virtual void afterTest()
|
| + {
|
| + }
|
| +
|
| +private:
|
| +};
|
| +
|
| +TEST_F(CCLayerTreeHostTestAbortFrameWhenInvisible, runMultiThread)
|
| +{
|
| + runTestThreaded();
|
| +}
|
| +
|
| +
|
| // Trigger a frame with setNeedsCommit. Then, inside the resulting animate
|
| // callback, requet another frame using setNeedsAnimate. End the test when
|
| // animate gets called yet-again, indicating that the proxy is correctly
|
| @@ -952,113 +986,6 @@
|
| runTest(true);
|
| }
|
|
|
| -class CCLayerTreeHostTestVisibilityAndAllocationControlDrawing : public CCLayerTreeHostTest {
|
| -public:
|
| -
|
| - CCLayerTreeHostTestVisibilityAndAllocationControlDrawing() { }
|
| -
|
| - virtual void beginTest()
|
| - {
|
| - postSetNeedsCommitToMainThread();
|
| - }
|
| -
|
| - virtual void didCommitAndDrawFrame()
|
| - {
|
| - int lastFrame = m_layerTreeHost->frameNumber() - 1;
|
| -
|
| - // These frames should draw.
|
| - switch (lastFrame) {
|
| - case 0:
|
| - // Set the tree invisible, this should not draw.
|
| - m_layerTreeHost->setVisible(false);
|
| - break;
|
| - case 2:
|
| - // Set the tree invisible and give a non-visible allocation, this
|
| - // should not draw.
|
| - m_layerTreeHost->setVisible(false);
|
| - m_layerTreeHost->setContentsMemoryAllocationLimitBytes(0);
|
| - break;
|
| - case 5:
|
| - // Give a memory allocation not for display, but while we are
|
| - // visible. This should not be used and we should remain
|
| - // ready for display and it should draw.
|
| - m_layerTreeHost->setContentsMemoryAllocationLimitBytes(0);
|
| - break;
|
| - case 6:
|
| - endTest();
|
| - break;
|
| -
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - }
|
| -
|
| - virtual void didCommit()
|
| - {
|
| - int lastFrame = m_layerTreeHost->frameNumber() - 1;
|
| -
|
| - // These frames should not draw.
|
| - switch (lastFrame) {
|
| - case 1:
|
| - // Set the tree visible, this should draw.
|
| - m_layerTreeHost->setVisible(true);
|
| - break;
|
| - case 3:
|
| - // Set visible without giving a visible memory allocation, this
|
| - // shouldn't make the impl side ready for display, so it should
|
| - // not draw.
|
| - m_layerTreeHost->setVisible(true);
|
| - break;
|
| - case 4:
|
| - // Now give a memory allocation for display, this should draw.
|
| - m_layerTreeHost->setContentsMemoryAllocationLimitBytes(1);
|
| - break;
|
| - }
|
| - }
|
| -
|
| - virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
|
| - {
|
| - switch (impl->sourceFrameNumber()) {
|
| - case 0:
|
| - // The host starts out visible and able to display before we do any commit.
|
| - EXPECT_TRUE(impl->visible());
|
| - EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - case 1:
|
| - // We still have a memory allocation for display.
|
| - EXPECT_FALSE(impl->visible());
|
| - EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - case 2:
|
| - EXPECT_TRUE(impl->visible());
|
| - EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - case 3:
|
| - EXPECT_FALSE(impl->visible());
|
| - EXPECT_FALSE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - case 4:
|
| - EXPECT_TRUE(impl->visible());
|
| - EXPECT_FALSE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - case 5:
|
| - EXPECT_TRUE(impl->visible());
|
| - EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - case 6:
|
| - EXPECT_TRUE(impl->visible());
|
| - EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
|
| - break;
|
| - }
|
| - }
|
| -
|
| - virtual void afterTest()
|
| - {
|
| - }
|
| -};
|
| -
|
| -SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestVisibilityAndAllocationControlDrawing)
|
| -
|
| // Verifies that startPageScaleAnimation events propagate correctly from CCLayerTreeHost to
|
| // CCLayerTreeHostImpl in the MT compositor.
|
| class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest {
|
| @@ -1689,7 +1616,7 @@
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
|
| CCTextureUpdater updater;
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
|
| @@ -1706,7 +1633,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
|
| @@ -1724,7 +1651,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
|
| @@ -1744,7 +1671,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
|
| @@ -1766,7 +1693,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
|
| @@ -1788,7 +1715,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
|
| @@ -1811,7 +1738,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
|
| @@ -1834,7 +1761,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
|
| @@ -1897,7 +1824,7 @@
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
|
| CCTextureUpdater updater;
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
|
| @@ -1924,7 +1851,7 @@
|
|
|
| m_layerTreeHost->setRootLayer(rootLayer);
|
| m_layerTreeHost->setViewportSize(rootLayer->bounds());
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
|
| @@ -1986,7 +1913,7 @@
|
| m_layerTreeHost->setViewportSize(layers[0]->bounds());
|
| ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
|
| CCTextureUpdater updater;
|
| - m_layerTreeHost->updateLayers(updater);
|
| + m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
|
| m_layerTreeHost->commitComplete();
|
|
|
| for (int i = 0; i < numSurfaces-1; ++i) {
|
|
|