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

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

Issue 10829399: Merge 125799 - [chromium] Impl scrolling crashes when the renderer's initialization failed (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 4 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/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.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/CCLayerTreeHostImplTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (revision 125940)
+++ Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (working copy)
@@ -187,6 +187,11 @@
CCScopedSettings m_scopedSettings;
};
+class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D {
+public:
+ virtual bool makeContextCurrent() { return false; }
+};
+
TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers)
{
ASSERT_FALSE(m_hostImpl->rootLayer());
@@ -273,6 +278,21 @@
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored);
}
+TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer)
+{
+ CCLayerTreeSettings settings;
+ m_hostImpl = CCLayerTreeHostImpl::create(settings, this);
+
+ // Initialization will fail here.
+ m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader);
mal 2012/08/18 22:45:09 third_party/WebKit/Source/WebKit/chromium/tests/CC
+ m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+
+ setupScrollAndContentsLayers(IntSize(100, 100));
+
+ // We should not crash when trying to scroll after the renderer initialization fails.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored);
+}
+
TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling)
{
const int scrollLayerId = 1;
@@ -2111,13 +2131,11 @@
EXPECT_TRUE(layer2->didLoseContextCalled());
}
-class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D {
-public:
- virtual bool makeContextCurrent() { return false; }
-};
-
TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost)
{
+ CCLayerTreeSettings settings;
+ m_hostImpl = CCLayerTreeHostImpl::create(settings, this);
+
// The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader);
m_hostImpl->finishAllRendering();
« no previous file with comments | « Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698