diff options
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/fake_output_surface.cc | 12 | ||||
-rw-r--r-- | cc/test/fake_output_surface.h | 8 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.cc | 4 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.h | 3 | ||||
-rw-r--r-- | cc/test/pixel_test_output_surface.h | 2 | ||||
-rw-r--r-- | cc/test/render_pass_test_common.cc | 113 | ||||
-rw-r--r-- | cc/test/render_pass_test_common.h | 3 | ||||
-rw-r--r-- | cc/test/render_pass_test_utils.cc | 2 | ||||
-rw-r--r-- | cc/test/render_pass_test_utils.h | 2 |
9 files changed, 102 insertions, 47 deletions
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc index a312041..ebbe783 100644 --- a/cc/test/fake_output_surface.cc +++ b/cc/test/fake_output_surface.cc @@ -7,13 +7,15 @@ namespace cc { FakeOutputSurface::FakeOutputSurface( - scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) { + scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) + : num_sent_frames_(0) { context3d_ = context3d.Pass(); capabilities_.has_parent_compositor = has_parent; } FakeOutputSurface::FakeOutputSurface( - scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) { + scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) + : num_sent_frames_(0) { software_device_ = software_device.Pass(); capabilities_.has_parent_compositor = has_parent; } @@ -43,6 +45,10 @@ SoftwareOutputDevice* FakeOutputSurface::SoftwareDevice() const { return software_device_.get(); } -void FakeOutputSurface::SendFrameToParentCompositor(const CompositorFrame&) {} +void FakeOutputSurface::SendFrameToParentCompositor( + CompositorFrame* frame) { + frame->AssignTo(&last_sent_frame_); + ++num_sent_frames_; +} } // namespace cc diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h index d843cca..0cfb41f 100644 --- a/cc/test/fake_output_surface.h +++ b/cc/test/fake_output_surface.h @@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "cc/compositor_frame.h" #include "cc/output_surface.h" #include "cc/test/fake_software_output_device.h" #include "cc/test/fake_web_graphics_context_3d.h" @@ -47,7 +48,10 @@ class FakeOutputSurface : public OutputSurface { virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; - virtual void SendFrameToParentCompositor(const CompositorFrame&) OVERRIDE; + virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE; + + CompositorFrame& last_sent_frame() { return last_sent_frame_; } + size_t num_sent_frames() { return num_sent_frames_; } private: explicit FakeOutputSurface( @@ -59,6 +63,8 @@ private: scoped_ptr<SoftwareOutputDevice> software_device_; struct Capabilities capabilities_; OutputSurfaceClient* client_; + CompositorFrame last_sent_frame_; + size_t num_sent_frames_; }; static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc index cfe6861..f710f4b 100644 --- a/cc/test/layer_tree_test_common.cc +++ b/cc/test/layer_tree_test_common.cc @@ -29,7 +29,7 @@ using namespace WebKit; namespace cc { -bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*) +bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool) { return true; } @@ -64,7 +64,7 @@ void MockLayerTreeHostImpl::commitComplete() bool MockLayerTreeHostImpl::prepareToDraw(FrameData& frame) { bool result = LayerTreeHostImpl::prepareToDraw(frame); - if (!m_testHooks->prepareToDrawOnThread(this)) + if (!m_testHooks->prepareToDrawOnThread(this, frame, result)) result = false; return result; } diff --git a/cc/test/layer_tree_test_common.h b/cc/test/layer_tree_test_common.h index 3b0cfd6..682edec 100644 --- a/cc/test/layer_tree_test_common.h +++ b/cc/test/layer_tree_test_common.h @@ -24,7 +24,8 @@ class TestHooks : public WebKit::WebAnimationDelegate { public: virtual void beginCommitOnThread(LayerTreeHostImpl*) { } virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } - virtual bool prepareToDrawOnThread(LayerTreeHostImpl*); + virtual bool prepareToDrawOnThread( + LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); virtual void drawLayersOnThread(LayerTreeHostImpl*) { } virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime, bool hasUnfinishedAnimation) { } virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime) { } diff --git a/cc/test/pixel_test_output_surface.h b/cc/test/pixel_test_output_surface.h index b3f26c41..91d789f 100644 --- a/cc/test/pixel_test_output_surface.h +++ b/cc/test/pixel_test_output_surface.h @@ -24,7 +24,7 @@ class PixelTestOutputSurface : public OutputSurface { OVERRIDE; virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; - virtual void SendFrameToParentCompositor(const CompositorFrame&) OVERRIDE {} + virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE {} private: PixelTestOutputSurface(); diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc index b66ca4f..b0b2281 100644 --- a/cc/test/render_pass_test_common.cc +++ b/cc/test/render_pass_test_common.cc @@ -20,7 +20,7 @@ namespace cc { void TestRenderPass::AppendOneOfEveryQuadType( - cc::ResourceProvider* resourceProvider) { + cc::ResourceProvider* resourceProvider, RenderPass::Id child_pass) { gfx::Rect rect(0, 0, 100, 100); gfx::Rect opaque_rect(10, 10, 80, 80); const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -31,6 +31,31 @@ void TestRenderPass::AppendOneOfEveryQuadType( ResourceProvider::TextureUsageAny); unsigned texture_id = ResourceProvider::ScopedReadLockGL( resourceProvider, texture_resource).textureId(); + cc::ResourceProvider::ResourceId resource1 = + resourceProvider->createResource( + gfx::Size(45, 5), + resourceProvider->bestTextureFormat(), + ResourceProvider::TextureUsageAny); + cc::ResourceProvider::ResourceId resource2 = + resourceProvider->createResource( + gfx::Size(346, 61), + resourceProvider->bestTextureFormat(), + ResourceProvider::TextureUsageAny); + cc::ResourceProvider::ResourceId resource3 = + resourceProvider->createResource( + gfx::Size(12, 134), + resourceProvider->bestTextureFormat(), + ResourceProvider::TextureUsageAny); + cc::ResourceProvider::ResourceId resource4 = + resourceProvider->createResource( + gfx::Size(56, 12), + resourceProvider->bestTextureFormat(), + ResourceProvider::TextureUsageAny); + cc::ResourceProvider::ResourceId resource5 = + resourceProvider->createResource( + gfx::Size(73, 26), + resourceProvider->bestTextureFormat(), + ResourceProvider::TextureUsageAny); scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create(); shared_state->SetAll(gfx::Transform(), @@ -65,19 +90,35 @@ void TestRenderPass::AppendOneOfEveryQuadType( cc::IOSurfaceDrawQuad::FLIPPED); AppendQuad(io_surface_quad.PassAs<DrawQuad>()); - scoped_ptr<cc::RenderPassDrawQuad> render_pass_quad = - cc::RenderPassDrawQuad::Create(); - render_pass_quad->SetNew(shared_state.get(), - rect, - cc::RenderPass::Id(1, 1), - false, - 0, - rect, - gfx::RectF(), - WebKit::WebFilterOperations(), - skia::RefPtr<SkImageFilter>(), - WebKit::WebFilterOperations()); - AppendQuad(render_pass_quad.PassAs<DrawQuad>()); + if (child_pass.layer_id) { + scoped_ptr<cc::RenderPassDrawQuad> render_pass_quad = + cc::RenderPassDrawQuad::Create(); + render_pass_quad->SetNew(shared_state.get(), + rect, + child_pass, + false, + resource5, + rect, + gfx::RectF(), + WebKit::WebFilterOperations(), + skia::RefPtr<SkImageFilter>(), + WebKit::WebFilterOperations()); + AppendQuad(render_pass_quad.PassAs<DrawQuad>()); + + scoped_ptr<cc::RenderPassDrawQuad> render_pass_replica_quad = + cc::RenderPassDrawQuad::Create(); + render_pass_replica_quad->SetNew(shared_state.get(), + rect, + child_pass, + true, + resource5, + rect, + gfx::RectF(), + WebKit::WebFilterOperations(), + skia::RefPtr<SkImageFilter>(), + WebKit::WebFilterOperations()); + AppendQuad(render_pass_replica_quad.PassAs<DrawQuad>()); + } scoped_ptr<cc::SolidColorDrawQuad> solid_color_quad = cc::SolidColorDrawQuad::Create(); @@ -100,7 +141,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( texture_quad->SetNew(shared_state.get(), rect, opaque_rect, - texture_resource, + resource1, false, rect, vertex_opacity, @@ -110,16 +151,16 @@ void TestRenderPass::AppendOneOfEveryQuadType( scoped_ptr<cc::TileDrawQuad> scaled_tile_quad = cc::TileDrawQuad::Create(); scaled_tile_quad->SetNew(shared_state.get(), - rect, - opaque_rect, - texture_resource, - gfx::RectF(0, 0, 50, 50), - gfx::Size(50, 50), - false, - false, - false, - false, - false); + rect, + opaque_rect, + resource2, + gfx::RectF(0, 0, 50, 50), + gfx::Size(50, 50), + false, + false, + false, + false, + false); AppendQuad(scaled_tile_quad.PassAs<DrawQuad>()); scoped_ptr<cc::SharedQuadState> transformed_state = shared_state->Copy(); @@ -129,16 +170,16 @@ void TestRenderPass::AppendOneOfEveryQuadType( scoped_ptr<cc::TileDrawQuad> transformed_tile_quad = cc::TileDrawQuad::Create(); transformed_tile_quad->SetNew(transformed_state.get(), - rect, - opaque_rect, - texture_resource, - gfx::RectF(0, 0, 100, 100), - gfx::Size(100, 100), - false, - false, - false, - false, - false); + rect, + opaque_rect, + resource3, + gfx::RectF(0, 0, 100, 100), + gfx::Size(100, 100), + false, + false, + false, + false, + false); AppendQuad(transformed_tile_quad.PassAs<DrawQuad>()); scoped_ptr<cc::TileDrawQuad> tile_quad = @@ -146,7 +187,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( tile_quad->SetNew(shared_state.get(), rect, opaque_rect, - texture_resource, + resource4, gfx::RectF(0, 0, 100, 100), gfx::Size(100, 100), false, diff --git a/cc/test/render_pass_test_common.h b/cc/test/render_pass_test_common.h index c565df0..b1f00de 100644 --- a/cc/test/render_pass_test_common.h +++ b/cc/test/render_pass_test_common.h @@ -26,7 +26,8 @@ class TestRenderPass : public cc::RenderPass { shared_quad_state_list.append(state.Pass()); } - void AppendOneOfEveryQuadType(cc::ResourceProvider*); + void AppendOneOfEveryQuadType( + cc::ResourceProvider*, RenderPass::Id child_pass); protected: TestRenderPass() : RenderPass() {} diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index aa0cc034..1aa97f0 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -15,7 +15,7 @@ namespace cc { -TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, +TestRenderPass* addRenderPass(RenderPassList& passList, RenderPass::Id id, const gfx::Rect& outputRect, const gfx::Transform& rootTransform) { diff --git a/cc/test/render_pass_test_utils.h b/cc/test/render_pass_test_utils.h index 140e029..b4d8dba 100644 --- a/cc/test/render_pass_test_utils.h +++ b/cc/test/render_pass_test_utils.h @@ -22,7 +22,7 @@ class TestRenderPass; // Adds a new render pass with the provided properties to the given // render pass list. TestRenderPass* addRenderPass( - ScopedPtrVector<RenderPass>& passList, + RenderPassList& passList, RenderPass::Id id, const gfx::Rect& outputRect, const gfx::Transform& rootTransform); |