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

Unified Diff: Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

Issue 10377150: Merge 116587 - [chromium] Don't draw when canDraw() is false (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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 | « Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (revision 117086)
+++ Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (working copy)
@@ -840,7 +840,63 @@
runTestThreaded();
}
+// If the layerTreeHost says it can't draw, then we should not try to draw.
+// FIXME: Make this run in single threaded mode too. http://crbug.com/127481
+class CCLayerTreeHostTestCanDrawBlocksDrawing : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestCanDrawBlocksDrawing()
+ : m_numCommits(0)
+ {
+ }
+ virtual void beginTest()
+ {
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ // Only the initial draw should bring us here.
+ EXPECT_TRUE(impl->canDraw());
+ EXPECT_EQ(0, impl->sourceFrameNumber());
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ if (m_numCommits >= 1) {
+ // After the first commit, we should not be able to draw.
+ EXPECT_FALSE(impl->canDraw());
+ }
+ }
+
+ virtual void didCommitAndDrawFrame()
+ {
+ m_numCommits++;
+ if (m_numCommits == 1) {
+ // Make the viewport empty so the host says it can't draw.
+ m_layerTreeHost->setViewportSize(IntSize(0, 0));
+
+ OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4]));
+ m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1));
+ } else if (m_numCommits == 2) {
+ m_layerTreeHost->setNeedsCommit();
+ m_layerTreeHost->finishAllRendering();
+ endTest();
+ }
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+ int m_numCommits;
+};
+
+TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing, runMultiThread)
+{
+ runTestThreaded();
+}
+
// beginLayerWrite should prevent draws from executing until a commit occurs
class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnly {
public:
« no previous file with comments | « Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698