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

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

Issue 10146014: Merge 113677 - [chromium] Viewport is not filled when out of texture memory on mac (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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
Index: Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (revision 114754)
+++ Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (working copy)
@@ -28,6 +28,7 @@
#include "cc/CCQuadCuller.h"
#include "CCAnimationTestCommon.h"
+#include "CCLayerTestCommon.h"
#include "FakeWebGraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
#include "LayerRendererChromium.h"
@@ -37,6 +38,7 @@
#include "cc/CCTileDrawQuad.h"
#include <gtest/gtest.h>
+using namespace CCLayerTestCommon;
using namespace WebCore;
using namespace WebKit;
using namespace WebKitTests;
@@ -598,6 +600,7 @@
testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect);
EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending());
EXPECT_EQ(m_hasRenderSurface, !!renderSurface());
+ quadList.append(testBlendingDrawQuad.release());
}
void setExpectation(bool blend, bool hasRenderSurface)
@@ -841,6 +844,88 @@
}
+TEST_F(CCLayerTreeHostImplTest, viewportCovered)
+{
+ m_hostImpl->initializeLayerRenderer(createContext());
+ m_hostImpl->setBackgroundColor(Color::gray);
+
+ IntSize viewportSize(100, 100);
+ m_hostImpl->setViewportSize(viewportSize);
+
+ m_hostImpl->setRootLayer(BlendStateCheckLayer::create(0));
+ BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer());
+ root->setExpectation(false, true);
+ root->setOpaque(true);
+
+ // No gutter rects
+ {
+ IntRect layerRect(0, 0, 100, 100);
+ root->setPosition(layerRect.location());
+ root->setBounds(layerRect.size());
+ root->setContentBounds(layerRect.size());
+ root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
+ root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ ASSERT_EQ(1u, frame.renderPasses.size());
+
+ size_t numGutterQuads = 0;
+ for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
+ numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0;
+ EXPECT_EQ(0u, numGutterQuads);
+ EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
+
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize));
+ }
+
+ // Empty visible content area (fullscreen gutter rect)
+ {
+ IntRect layerRect(0, 0, 0, 0);
+ root->setPosition(layerRect.location());
+ root->setBounds(layerRect.size());
+ root->setContentBounds(layerRect.size());
+ root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
+ root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ ASSERT_EQ(1u, frame.renderPasses.size());
+
+ size_t numGutterQuads = 0;
+ for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
+ numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0;
+ EXPECT_EQ(1u, numGutterQuads);
+ EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
+
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize));
+ }
+
+ // Content area in middle of clip rect (four surrounding gutter rects)
+ {
+ IntRect layerRect(50, 50, 20, 20);
+ root->setPosition(layerRect.location());
+ root->setBounds(layerRect.size());
+ root->setContentBounds(layerRect.size());
+ root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
+ root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ ASSERT_EQ(1u, frame.renderPasses.size());
+
+ size_t numGutterQuads = 0;
+ for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
+ numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0;
+ EXPECT_EQ(4u, numGutterQuads);
+ EXPECT_EQ(5u, frame.renderPasses[0]->quadList().size());
+
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize));
+ }
+
+}
+
+
class ReshapeTrackerContext: public FakeWebGraphicsContext3D {
public:
ReshapeTrackerContext() : m_reshapeCalled(false) { }
« no previous file with comments | « Source/WebKit/chromium/tests/CCLayerImplTest.cpp ('k') | Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698