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

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11348371: cc: Move WebCompositorOutputSurface and related classes into cc/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mynits Created 8 years 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: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index b13b2a96decb2e438fe0debba3b37d5667bfe1e0..b8b108c7685535855f9e4ff71b380cfaf636d8c9 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -23,8 +23,8 @@
#include "cc/single_thread_proxy.h"
#include "cc/solid_color_draw_quad.h"
#include "cc/test/animation_test_common.h"
+#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_proxy.h"
-#include "cc/test/fake_web_compositor_output_surface.h"
#include "cc/test/fake_web_graphics_context_3d.h"
#include "cc/test/fake_web_scrollbar_theme_geometry.h"
#include "cc/test/geometry_test_utils.h"
@@ -207,7 +207,7 @@ public:
protected:
scoped_ptr<GraphicsContext> createContext()
{
- return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
+ return FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
}
FakeProxy m_proxy;
@@ -376,7 +376,7 @@ TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer)
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
// Initialization will fail here.
- m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
+ m_hostImpl->initializeRenderer(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
setupScrollAndContentsLayers(gfx::Size(100, 100));
@@ -1992,8 +1992,8 @@ protected:
// viewport size is never set.
TEST_P(LayerTreeHostImplTest, reshapeNotCalledUntilDraw)
{
- scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<GraphicsContext>();
- ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->context3D());
+ scoped_ptr<GraphicsContext> outputSurface = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<GraphicsContext>();
+ ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->Context3D());
m_hostImpl->initializeRenderer(outputSurface.Pass());
scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
@@ -2035,8 +2035,8 @@ private:
// where it should request to swap only the subBuffer that is damaged.
TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
{
- scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<GraphicsContext>();
- PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(outputSurface->context3D());
+ scoped_ptr<GraphicsContext> outputSurface = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<GraphicsContext>();
+ PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(outputSurface->Context3D());
// This test creates its own LayerTreeHostImpl, so
// that we can force partial swap enabled.
@@ -2250,8 +2250,8 @@ public:
TEST_P(LayerTreeHostImplTest, noPartialSwap)
{
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>();
- MockContext* mockContext = static_cast<MockContext*>(context->context3D());
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>();
+ MockContext* mockContext = static_cast<MockContext*>(context->Context3D());
MockContextHarness harness(mockContext);
// Run test case
@@ -2283,8 +2283,8 @@ TEST_P(LayerTreeHostImplTest, noPartialSwap)
TEST_P(LayerTreeHostImplTest, partialSwap)
{
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>();
- MockContext* mockContext = static_cast<MockContext*>(context->context3D());
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<GraphicsContext>();
+ MockContext* mockContext = static_cast<MockContext*>(context->Context3D());
MockContextHarness harness(mockContext);
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.Pass(), FakeLayerWithQuads::create(1));
@@ -2339,7 +2339,7 @@ public:
static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client, Proxy* proxy)
{
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
LayerTreeSettings settings;
settings.partialSwapEnabled = partialSwap;
@@ -2495,7 +2495,7 @@ TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost)
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
// The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
- m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
+ m_hostImpl->initializeRenderer(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
m_hostImpl->finishAllRendering();
}
@@ -2533,14 +2533,14 @@ TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize)
for (unsigned i = 0; i < kMakeCurrentSuccessesNeededForSuccessfulInitialization; ++i) {
// The context will get lost during initialization, we shouldn't crash. We
// should also be in a consistent state.
- EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<GraphicsContext>()));
+ EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<GraphicsContext>()));
EXPECT_EQ(0, m_hostImpl->context());
EXPECT_EQ(0, m_hostImpl->renderer());
EXPECT_EQ(0, m_hostImpl->resourceProvider());
EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext()));
}
- EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<GraphicsContext>()));
+ EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<GraphicsContext>()));
EXPECT_TRUE(m_hostImpl->context());
EXPECT_TRUE(m_hostImpl->renderer());
EXPECT_TRUE(m_hostImpl->resourceProvider());
@@ -2894,7 +2894,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>());
// Use a context that supports IOSurfaces
- m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
+ m_hostImpl->initializeRenderer(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
FakeVideoFrame hwVideoFrame(
VideoFrame::WrapNativeTexture(
@@ -2924,7 +2924,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
// Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface,
// that will warn if any resource from the previous context gets used.
- m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
+ m_hostImpl->initializeRenderer(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
// Create dummy resources so that looking up an old resource will get an
// invalid texture id mapping.
@@ -3043,8 +3043,8 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>());
// Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of).
- scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D)));
- TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(outputSurface->context3D());
+ scoped_ptr<GraphicsContext> outputSurface(FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D)));
+ TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(outputSurface->Context3D());
m_hostImpl->initializeRenderer(outputSurface.Pass());
m_hostImpl->setRootLayer(rootLayer.Pass());
@@ -3071,8 +3071,8 @@ public:
TEST_P(LayerTreeHostImplTest, hasTransparentBackground)
{
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<GraphicsContext>();
- MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D());
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<GraphicsContext>();
+ MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->Context3D());
// Run test case
scoped_ptr<LayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.Pass(), LayerImpl::create(1));
@@ -3115,7 +3115,7 @@ static void addDrawingLayerTo(LayerImpl* parent, int id, const gfx::Rect& layerR
static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, LayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPtr, LayerImpl*& childPtr, const gfx::Size& rootSize)
{
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
layerTreeHostImpl->initializeRenderer(context.Pass());
layerTreeHostImpl->setViewportSize(rootSize, rootSize);
@@ -3159,7 +3159,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
LayerImpl* rootPtr;
LayerImpl* surfaceLayerPtr;
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
gfx::Size rootSize(100, 100);
@@ -3270,7 +3270,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
LayerImpl* layerS1Ptr;
LayerImpl* layerS2Ptr;
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
gfx::Size rootSize(1000, 1000);
@@ -3381,7 +3381,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
LayerImpl* layerS1Ptr;
LayerImpl* layerS2Ptr;
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
gfx::Size rootSize(1000, 1000);
@@ -3493,7 +3493,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
LayerImpl* layerS1Ptr;
LayerImpl* layerS2Ptr;
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
gfx::Size rootSize(1000, 1000);
@@ -3574,7 +3574,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
LayerImpl* rootPtr;
LayerImpl* layerS1Ptr;
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
gfx::Size rootSize(1000, 1000);
@@ -3658,7 +3658,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
LayerImpl* layerS1Ptr;
LayerImpl* layerS2Ptr;
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
gfx::Size rootSize(1000, 1000);
@@ -3777,7 +3777,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
gfx::Rect childRect(10, 10, 50, 50);
gfx::Rect grandChildRect(5, 5, 150, 150);
- scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
+ scoped_ptr<GraphicsContext> context = FakeOutputSurface::Create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
myHostImpl->initializeRenderer(context.Pass());
root->setAnchorPoint(gfx::PointF(0, 0));
@@ -4519,7 +4519,7 @@ static void verifyRenderPassTestData(TestCase& testCase, RenderPassRemovalTestDa
TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses)
{
scoped_ptr<GraphicsContext> context(createContext());
- ASSERT_TRUE(context->context3D());
+ ASSERT_TRUE(context->Context3D());
scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get()));
scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get(), &m_proxy));
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | cc/output_surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698