| Index: cc/trees/layer_tree_host_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
|
| index d01fbae1778d0fa4868c59028916ac7c31c1dd4d..aa06373c51c12620a49faeb46ea0478a33594d2a 100644
|
| --- a/cc/trees/layer_tree_host_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_unittest.cc
|
| @@ -65,8 +65,7 @@ using testing::Mock;
|
| namespace cc {
|
| namespace {
|
|
|
| -class LayerTreeHostTest : public LayerTreeTest {
|
| -};
|
| +class LayerTreeHostTest : public LayerTreeTest {};
|
|
|
| // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
|
| // draw with frame 0.
|
| @@ -276,8 +275,7 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
|
| : num_draws_(0),
|
| bounds_(50, 50),
|
| invalid_rect_(10, 10, 20, 20),
|
| - root_layer_(ContentLayer::Create(&client_)) {
|
| - }
|
| + root_layer_(ContentLayer::Create(&client_)) {}
|
|
|
| virtual void BeginTest() OVERRIDE {
|
| root_layer_->SetIsDrawable(true);
|
| @@ -316,9 +314,7 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
|
| num_draws_++;
|
| }
|
|
|
| - virtual void AfterTest() OVERRIDE {
|
| - EXPECT_EQ(2, num_draws_);
|
| - }
|
| + virtual void AfterTest() OVERRIDE { EXPECT_EQ(2, num_draws_); }
|
|
|
| private:
|
| int num_draws_;
|
| @@ -348,9 +344,7 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
|
| if (host_impl->active_tree()->source_frame_number() == 1)
|
| @@ -408,9 +402,7 @@ class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
|
| if (host_impl->active_tree()->source_frame_number() == 1)
|
| @@ -645,8 +637,7 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
|
| : num_draws_(0),
|
| bounds_(50, 50),
|
| invalid_rect_(10, 10, 20, 20),
|
| - root_layer_(ContentLayer::Create(&client_)) {
|
| - }
|
| + root_layer_(ContentLayer::Create(&client_)) {}
|
|
|
| virtual void BeginTest() OVERRIDE {
|
| root_layer_->SetIsDrawable(true);
|
| @@ -718,9 +709,7 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
|
| num_draws_++;
|
| }
|
|
|
| - virtual void AfterTest() OVERRIDE {
|
| - EXPECT_EQ(5, num_draws_);
|
| - }
|
| + virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); }
|
|
|
| private:
|
| int num_draws_;
|
| @@ -737,8 +726,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
|
| class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
|
| public:
|
| LayerTreeHostTestUndrawnLayersDamageLater()
|
| - : root_layer_(ContentLayer::Create(&client_)) {
|
| - }
|
| + : root_layer_(ContentLayer::Create(&client_)) {}
|
|
|
| virtual void SetupTree() OVERRIDE {
|
| root_layer_->SetIsDrawable(true);
|
| @@ -759,9 +747,7 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| LayerTreeHostImpl::FrameData* frame_data,
|
| @@ -815,7 +801,6 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
|
| }
|
| }
|
|
|
| -
|
| virtual void AfterTest() OVERRIDE {}
|
|
|
| private:
|
| @@ -1033,7 +1018,7 @@ class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
|
| PostSetNeedsCommitToMainThread();
|
| }
|
|
|
| - virtual void BeginCommitOnThread(LayerTreeHostImpl *impl) OVERRIDE {
|
| + virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| EXPECT_EQ(frame_count_with_pending_tree_, 0);
|
| impl->BlockNotifyReadyToActivateForTesting(true);
|
| }
|
| @@ -1103,7 +1088,8 @@ class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest {
|
|
|
| // Since we might use a low-resolution clock on Windows, we need to
|
| // make sure that the clock has incremented past first_frame_time_.
|
| - while (first_frame_time_ == gfx::FrameTime::Now()) {}
|
| + while (first_frame_time_ == gfx::FrameTime::Now()) {
|
| + }
|
|
|
| return;
|
| }
|
| @@ -1132,8 +1118,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterDraw);
|
|
|
| // Verifies that StartPageScaleAnimation events propagate correctly
|
| // from LayerTreeHost to LayerTreeHostImpl in the MT compositor.
|
| -class LayerTreeHostTestStartPageScaleAnimation
|
| - : public LayerTreeHostTest {
|
| +class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
|
| public:
|
| LayerTreeHostTestStartPageScaleAnimation() {}
|
|
|
| @@ -1155,12 +1140,10 @@ class LayerTreeHostTestStartPageScaleAnimation
|
| layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f);
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale)
|
| - OVERRIDE {
|
| + virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
|
| + float scale) OVERRIDE {
|
| gfx::Vector2d offset = scroll_layer_->scroll_offset();
|
| scroll_layer_->SetScrollOffset(offset + scroll_delta);
|
| layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f);
|
| @@ -1480,8 +1463,7 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
|
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
|
|
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| switch (impl->active_tree()->source_frame_number()) {
|
| case 0:
|
| @@ -1522,8 +1504,7 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
|
| }
|
|
|
| virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| if (drew_frame_ == impl->active_tree()->source_frame_number()) {
|
| EXPECT_EQ(0u, context->NumUsedTextures()) << "For frame " << drew_frame_;
|
| @@ -1559,8 +1540,7 @@ class LayerTreeHostTestDelegatingRendererAtomicCommit
|
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
|
|
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| switch (impl->active_tree()->source_frame_number()) {
|
| case 0:
|
| @@ -1648,9 +1628,7 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DidCommitAndDrawFrame() OVERRIDE {
|
| switch (layer_tree_host()->source_frame_number()) {
|
| @@ -1682,8 +1660,7 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
|
| virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates);
|
|
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| switch (impl->active_tree()->source_frame_number()) {
|
| case 0:
|
| @@ -1773,16 +1750,15 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
|
| virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| EXPECT_LT(impl->active_tree()->source_frame_number(), 5);
|
|
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| // Number of textures used for drawing should one per layer except for
|
| // frame 3 where the viewport only contains one layer.
|
| if (impl->active_tree()->source_frame_number() == 3) {
|
| EXPECT_EQ(1u, context->NumUsedTextures());
|
| } else {
|
| - EXPECT_EQ(2u, context->NumUsedTextures()) <<
|
| - "For frame " << impl->active_tree()->source_frame_number();
|
| + EXPECT_EQ(2u, context->NumUsedTextures())
|
| + << "For frame " << impl->active_tree()->source_frame_number();
|
| }
|
|
|
| context->ResetUsedTextures();
|
| @@ -1889,24 +1865,28 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
|
| Renderer* renderer = host_impl->renderer();
|
| RenderPass::Id surface1_render_pass_id = host_impl->active_tree()
|
| - ->root_layer()->children()[0]->render_surface()->RenderPassId();
|
| - RenderPass::Id surface2_render_pass_id =
|
| - host_impl->active_tree()->root_layer()->children()[0]->children()[0]
|
| - ->render_surface()->RenderPassId();
|
| + ->root_layer()
|
| + ->children()[0]
|
| + ->render_surface()
|
| + ->RenderPassId();
|
| + RenderPass::Id surface2_render_pass_id = host_impl->active_tree()
|
| + ->root_layer()
|
| + ->children()[0]
|
| + ->children()[0]
|
| + ->render_surface()
|
| + ->RenderPassId();
|
|
|
| switch (host_impl->active_tree()->source_frame_number()) {
|
| case 0:
|
| - EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting(
|
| - surface1_render_pass_id));
|
| - EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting(
|
| - surface2_render_pass_id));
|
| + EXPECT_TRUE(
|
| + renderer->HasAllocatedResourcesForTesting(surface1_render_pass_id));
|
| + EXPECT_TRUE(
|
| + renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id));
|
|
|
| // Reduce the memory limit to only fit the root layer and one render
|
| // surface. This prevents any contents drawing into surfaces
|
| @@ -1914,10 +1894,10 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
|
| host_impl->SetMemoryPolicy(ManagedMemoryPolicy(100 * 100 * 4 * 2));
|
| break;
|
| case 1:
|
| - EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting(
|
| - surface1_render_pass_id));
|
| - EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting(
|
| - surface2_render_pass_id));
|
| + EXPECT_FALSE(
|
| + renderer->HasAllocatedResourcesForTesting(surface1_render_pass_id));
|
| + EXPECT_FALSE(
|
| + renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id));
|
|
|
| EndTest();
|
| break;
|
| @@ -1953,8 +1933,7 @@ class EvictionTestLayer : public Layer {
|
| return make_scoped_refptr(new EvictionTestLayer());
|
| }
|
|
|
| - virtual bool Update(ResourceUpdateQueue*,
|
| - const OcclusionTracker*) OVERRIDE;
|
| + virtual bool Update(ResourceUpdateQueue*, const OcclusionTracker*) OVERRIDE;
|
| virtual bool DrawsContent() const OVERRIDE { return true; }
|
|
|
| virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
|
| @@ -2446,8 +2425,7 @@ class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
|
| layer_tree_host()->contents_texture_manager()->MemoryUseBytes());
|
| } else {
|
| EXPECT_EQ(
|
| - 0u,
|
| - layer_tree_host()->contents_texture_manager()->MemoryUseBytes());
|
| + 0u, layer_tree_host()->contents_texture_manager()->MemoryUseBytes());
|
| }
|
|
|
| // Make sure that contents textures are marked as having been
|
| @@ -2603,10 +2581,9 @@ class LayerTreeHostTestBeginImplFrameNotification : public LayerTreeHostTest {
|
| PostSetNeedsCommitToMainThread();
|
| }
|
|
|
| - virtual bool PrepareToDrawOnThread(
|
| - LayerTreeHostImpl* host_impl,
|
| - LayerTreeHostImpl::FrameData* frame,
|
| - bool result) OVERRIDE {
|
| + virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| + LayerTreeHostImpl::FrameData* frame,
|
| + bool result) OVERRIDE {
|
| EndTest();
|
| return true;
|
| }
|
| @@ -2665,8 +2642,8 @@ class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest {
|
| }
|
| }
|
|
|
| - virtual void BeginMainFrameAbortedOnThread(
|
| - LayerTreeHostImpl *host_impl, bool did_handle) OVERRIDE {
|
| + virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
|
| + bool did_handle) OVERRIDE {
|
| commit_abort_count_++;
|
| // Initiate another abortable commit.
|
| host_impl->SetNeedsCommit();
|
| @@ -2730,16 +2707,13 @@ class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
|
| layer_tree_host()->root_layer()->AddChild(layer);
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() OVERRIDE {
|
| - }
|
| + virtual void AfterTest() OVERRIDE {}
|
|
|
| FakeContentLayerClient client_;
|
| };
|
| @@ -2813,7 +2787,6 @@ class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
|
| virtual GLuint createTexture() OVERRIDE {
|
| return 1;
|
| }
|
| -
|
| MOCK_METHOD1(activeTexture, void(GLenum texture));
|
| MOCK_METHOD2(bindTexture, void(GLenum target,
|
| GLuint texture_id));
|
| @@ -2832,18 +2805,16 @@ class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
|
| MOCK_METHOD1(deleteTexture, void(GLenum texture));
|
| };
|
|
|
| -
|
| class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
|
| protected:
|
| - virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
|
| - OVERRIDE {
|
| + virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
|
| + bool fallback) OVERRIDE {
|
| scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned(
|
| new MockIOSurfaceWebGraphicsContext3D);
|
| mock_context_ = mock_context_owned.get();
|
|
|
| - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
|
| - mock_context_owned.PassAs<TestWebGraphicsContext3D>()));
|
| - return output_surface.Pass();
|
| + return FakeOutputSurface::Create3d(
|
| + mock_context_owned.PassAs<TestWebGraphicsContext3D>());
|
| }
|
|
|
| virtual void SetupTree() OVERRIDE {
|
| @@ -2862,55 +2833,48 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
|
| layer_tree_host()->root_layer()->AddChild(io_surface_layer);
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
|
| // In WillDraw, the IOSurfaceLayer sets up the io surface texture.
|
|
|
| - EXPECT_CALL(*mock_context_, activeTexture(_))
|
| - .Times(0);
|
| + EXPECT_CALL(*mock_context_, activeTexture(_)).Times(0);
|
| EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1))
|
| .Times(AtLeast(1));
|
| - EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
|
| - GL_TEXTURE_MIN_FILTER,
|
| - GL_LINEAR))
|
| - .Times(1);
|
| - EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
|
| - GL_TEXTURE_MAG_FILTER,
|
| - GL_LINEAR))
|
| + EXPECT_CALL(*mock_context_,
|
| + texParameteri(
|
| + GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR))
|
| .Times(1);
|
| - EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
|
| - GL_TEXTURE_WRAP_S,
|
| - GL_CLAMP_TO_EDGE))
|
| - .Times(1);
|
| - EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
|
| - GL_TEXTURE_WRAP_T,
|
| - GL_CLAMP_TO_EDGE))
|
| + EXPECT_CALL(*mock_context_,
|
| + texParameteri(
|
| + GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR))
|
| .Times(1);
|
| + EXPECT_CALL(*mock_context_,
|
| + texParameteri(GL_TEXTURE_RECTANGLE_ARB,
|
| + GL_TEXTURE_WRAP_S,
|
| + GL_CLAMP_TO_EDGE)).Times(1);
|
| + EXPECT_CALL(*mock_context_,
|
| + texParameteri(GL_TEXTURE_RECTANGLE_ARB,
|
| + GL_TEXTURE_WRAP_T,
|
| + GL_CLAMP_TO_EDGE)).Times(1);
|
|
|
| - EXPECT_CALL(*mock_context_, texImageIOSurface2DCHROMIUM(
|
| - GL_TEXTURE_RECTANGLE_ARB,
|
| - io_surface_size_.width(),
|
| - io_surface_size_.height(),
|
| - io_surface_id_,
|
| - 0))
|
| - .Times(1);
|
| + EXPECT_CALL(*mock_context_,
|
| + texImageIOSurface2DCHROMIUM(GL_TEXTURE_RECTANGLE_ARB,
|
| + io_surface_size_.width(),
|
| + io_surface_size_.height(),
|
| + io_surface_id_,
|
| + 0)).Times(1);
|
|
|
| - EXPECT_CALL(*mock_context_, bindTexture(_, 0))
|
| - .Times(AnyNumber());
|
| + EXPECT_CALL(*mock_context_, bindTexture(_, 0)).Times(AnyNumber());
|
| }
|
|
|
| - virtual bool PrepareToDrawOnThread(
|
| - LayerTreeHostImpl* host_impl,
|
| - LayerTreeHostImpl::FrameData* frame,
|
| - bool result) OVERRIDE {
|
| + virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| + LayerTreeHostImpl::FrameData* frame,
|
| + bool result) OVERRIDE {
|
| Mock::VerifyAndClearExpectations(&mock_context_);
|
|
|
| // The io surface layer's texture is drawn.
|
| - EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0))
|
| - .Times(AtLeast(1));
|
| + EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1));
|
| EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1))
|
| .Times(1);
|
| EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _))
|
| @@ -3068,10 +3032,9 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
|
| EXPECT_LE(2u, layer_impl->append_quads_count());
|
| ImplThreadTaskRunner()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(
|
| - &LayerTreeHostTestDeferredInitialize::ReleaseGLAndRedraw,
|
| - base::Unretained(this),
|
| - base::Unretained(host_impl)));
|
| + base::Bind(&LayerTreeHostTestDeferredInitialize::ReleaseGLAndRedraw,
|
| + base::Unretained(this),
|
| + base::Unretained(host_impl)));
|
| } else if (did_initialize_gl_ && did_release_gl_) {
|
| EXPECT_LE(3u, layer_impl->append_quads_count());
|
| EndTest();
|
| @@ -3085,8 +3048,8 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
|
| static_cast<FakeOutputSurface*>(host_impl->output_surface());
|
| scoped_refptr<TestContextProvider> context_provider =
|
| TestContextProvider::Create(); // Not bound to thread.
|
| - EXPECT_TRUE(fake_output_surface->InitializeAndSetContext3d(
|
| - context_provider, NULL));
|
| + EXPECT_TRUE(
|
| + fake_output_surface->InitializeAndSetContext3d(context_provider, NULL));
|
| did_initialize_gl_ = true;
|
| }
|
|
|
| @@ -3157,8 +3120,7 @@ class LayerTreeHostTestUIResource : public LayerTreeHostTest {
|
| }
|
|
|
| void PerformTest(LayerTreeHostImpl* impl) {
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| int frame = num_commits_;
|
| switch (frame) {
|
| @@ -3240,8 +3202,7 @@ class PushPropertiesCountingLayer : public Layer {
|
|
|
| private:
|
| PushPropertiesCountingLayer()
|
| - : push_properties_count_(0),
|
| - persist_needs_push_properties_(false) {
|
| + : push_properties_count_(0), persist_needs_push_properties_(false) {
|
| SetAnchorPoint(gfx::PointF());
|
| SetBounds(gfx::Size(1, 1));
|
| SetIsDrawable(true);
|
| @@ -3447,9 +3408,7 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestLayersPushProperties);
|
| class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
|
| : public LayerTreeHostTest {
|
| protected:
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void SetupTree() OVERRIDE {
|
| root_ = Layer::Create();
|
| @@ -3951,24 +3910,22 @@ class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest {
|
| EndTest();
|
| break;
|
| }
|
| - return LayerTreeHostTest::PrepareToDrawOnThread(host_impl, frame_data,
|
| - result);
|
| + return LayerTreeHostTest::PrepareToDrawOnThread(
|
| + host_impl, frame_data, result);
|
| }
|
|
|
| - virtual void AfterTest() OVERRIDE {
|
| - EXPECT_EQ(3, num_commits_);
|
| - }
|
| + virtual void AfterTest() OVERRIDE { EXPECT_EQ(3, num_commits_); }
|
|
|
| void SetCallback(bool enable) {
|
| - output_surface()->SetTreeActivationCallback(enable ?
|
| - base::Bind(&LayerTreeHostTestTreeActivationCallback::ActivationCallback,
|
| - base::Unretained(this)) :
|
| - base::Closure());
|
| + output_surface()->SetTreeActivationCallback(
|
| + enable
|
| + ? base::Bind(
|
| + &LayerTreeHostTestTreeActivationCallback::ActivationCallback,
|
| + base::Unretained(this))
|
| + : base::Closure());
|
| }
|
|
|
| - void ActivationCallback() {
|
| - ++callback_count_;
|
| - }
|
| + void ActivationCallback() { ++callback_count_; }
|
|
|
| int num_commits_;
|
| int callback_count_;
|
| @@ -3997,7 +3954,7 @@ class LayerInvalidateCausesDraw : public LayerTreeHostTest {
|
| virtual void DidCommitAndDrawFrame() OVERRIDE {
|
| // After commit, invalidate the layer. This should cause a commit.
|
| if (layer_tree_host()->source_frame_number() == 1)
|
| - invalidate_layer_->SetNeedsDisplay();
|
| + invalidate_layer_->SetNeedsDisplay();
|
| }
|
|
|
| virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| @@ -4241,13 +4198,12 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest {
|
| settings->default_tile_size = gfx::Size(128, 128);
|
| }
|
|
|
| - virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
|
| - OVERRIDE {
|
| + virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
|
| + bool fallback) OVERRIDE {
|
| scoped_refptr<TestContextProvider> context_provider =
|
| TestContextProvider::Create();
|
| context_provider->SetMaxTransferBufferUsageBytes(1024 * 1024);
|
| - return FakeOutputSurface::Create3d(context_provider)
|
| - .PassAs<OutputSurface>();
|
| + return FakeOutputSurface::Create3d(context_provider);
|
| }
|
|
|
| virtual void SetupTree() OVERRIDE {
|
| @@ -4260,21 +4216,17 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest {
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| - TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
|
| - impl->output_surface()->context_provider().get())->TestContext3d();
|
| + TestWebGraphicsContext3D* context = TestContext();
|
|
|
| // Expect that the transfer buffer memory used is equal to the
|
| // MaxTransferBufferUsageBytes value set in CreateOutputSurface.
|
| // NOTE: This is now 1/2 due to raster memory limit in TileManager.
|
| // Only half the limit will be reached unless the task set
|
| // thrashes to a completly new set of tiles.
|
| - EXPECT_EQ(512 * 1024u,
|
| - context->GetPeakTransferBufferMemoryUsedBytes());
|
| + EXPECT_EQ(512 * 1024u, context->GetPeakTransferBufferMemoryUsedBytes());
|
| EndTest();
|
| }
|
|
|
| @@ -4300,38 +4252,38 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
|
| switch (frame) {
|
| case 0:
|
| // Verify default values.
|
| - EXPECT_EQ(
|
| - PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
|
| - layer_tree_host()->contents_texture_manager()->
|
| - MaxMemoryLimitBytes());
|
| - EXPECT_EQ(
|
| - PriorityCalculator::AllowEverythingCutoff(),
|
| - layer_tree_host()->contents_texture_manager()->
|
| - ExternalPriorityCutoff());
|
| + EXPECT_EQ(PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
|
| + layer_tree_host()
|
| + ->contents_texture_manager()
|
| + ->MaxMemoryLimitBytes());
|
| + EXPECT_EQ(PriorityCalculator::AllowEverythingCutoff(),
|
| + layer_tree_host()
|
| + ->contents_texture_manager()
|
| + ->ExternalPriorityCutoff());
|
| PostSetNeedsCommitToMainThread();
|
| break;
|
| case 1:
|
| // The values should remain the same until the commit after the policy
|
| // is changed.
|
| - EXPECT_EQ(
|
| - PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
|
| - layer_tree_host()->contents_texture_manager()->
|
| - MaxMemoryLimitBytes());
|
| - EXPECT_EQ(
|
| - PriorityCalculator::AllowEverythingCutoff(),
|
| - layer_tree_host()->contents_texture_manager()->
|
| - ExternalPriorityCutoff());
|
| + EXPECT_EQ(PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
|
| + layer_tree_host()
|
| + ->contents_texture_manager()
|
| + ->MaxMemoryLimitBytes());
|
| + EXPECT_EQ(PriorityCalculator::AllowEverythingCutoff(),
|
| + layer_tree_host()
|
| + ->contents_texture_manager()
|
| + ->ExternalPriorityCutoff());
|
| break;
|
| case 2:
|
| // Verify values were correctly passed.
|
| - EXPECT_EQ(
|
| - 16u*1024u*1024u,
|
| - layer_tree_host()->contents_texture_manager()->
|
| - MaxMemoryLimitBytes());
|
| - EXPECT_EQ(
|
| - PriorityCalculator::AllowVisibleAndNearbyCutoff(),
|
| - layer_tree_host()->contents_texture_manager()->
|
| - ExternalPriorityCutoff());
|
| + EXPECT_EQ(16u * 1024u * 1024u,
|
| + layer_tree_host()
|
| + ->contents_texture_manager()
|
| + ->MaxMemoryLimitBytes());
|
| + EXPECT_EQ(PriorityCalculator::AllowVisibleAndNearbyCutoff(),
|
| + layer_tree_host()
|
| + ->contents_texture_manager()
|
| + ->ExternalPriorityCutoff());
|
| EndTest();
|
| break;
|
| case 3:
|
| @@ -4351,7 +4303,7 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
|
| case 1:
|
| // This will trigger a commit because the priority cutoff has changed.
|
| impl->SetMemoryPolicy(ManagedMemoryPolicy(
|
| - 16u*1024u*1024u,
|
| + 16u * 1024u * 1024u,
|
| gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
|
| 1000));
|
| break;
|
| @@ -4359,7 +4311,7 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
|
| // This will not trigger a commit because the priority cutoff has not
|
| // changed, and there is already enough memory for all allocations.
|
| impl->SetMemoryPolicy(ManagedMemoryPolicy(
|
| - 32u*1024u*1024u,
|
| + 32u * 1024u * 1024u,
|
| gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
|
| 1000));
|
| break;
|
| @@ -4458,13 +4410,11 @@ class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest {
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
|
| FakeContentLayerImpl* layer_impl =
|
| - static_cast<FakeContentLayerImpl*>(impl->RootLayer());
|
| + static_cast<FakeContentLayerImpl*>(impl->RootLayer());
|
| EXPECT_FALSE(layer_impl->DrawsContent());
|
| EXPECT_EQ(0u, layer_impl->append_quads_count());
|
| }
|
| @@ -4483,7 +4433,6 @@ class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest {
|
|
|
| SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForEmptyLayer);
|
|
|
| -
|
| } // namespace
|
|
|
| class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
|
| @@ -4502,16 +4451,13 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
|
| second_context_provider_ = TestContextProvider::Create();
|
| }
|
|
|
| - scoped_ptr<FakeOutputSurface> output_surface(
|
| - FakeOutputSurface::Create3d(
|
| - second_context_provider_ ?
|
| - second_context_provider_ :
|
| - first_context_provider_));
|
| - output_surface->SetMemoryPolicyToSetAtBind(make_scoped_ptr(
|
| - new ManagedMemoryPolicy(
|
| - second_context_provider_ ?
|
| - second_output_surface_memory_limit_ :
|
| - first_output_surface_memory_limit_,
|
| + scoped_ptr<FakeOutputSurface> output_surface(FakeOutputSurface::Create3d(
|
| + second_context_provider_ ? second_context_provider_
|
| + : first_context_provider_));
|
| + output_surface->SetMemoryPolicyToSetAtBind(
|
| + make_scoped_ptr(new ManagedMemoryPolicy(
|
| + second_context_provider_ ? second_output_surface_memory_limit_
|
| + : first_output_surface_memory_limit_,
|
| gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
|
| ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
|
| return output_surface.PassAs<OutputSurface>();
|
| @@ -4524,9 +4470,7 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
|
| LayerTreeHostTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() OVERRIDE {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void DidCommitAndDrawFrame() OVERRIDE {
|
| // Lost context sometimes takes two frames to recreate. The third frame
|
| @@ -4539,16 +4483,15 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
|
| }
|
| }
|
|
|
| - virtual void SwapBuffersOnThread(LayerTreeHostImpl *impl, bool result)
|
| - OVERRIDE {
|
| + virtual void SwapBuffersOnThread(LayerTreeHostImpl* impl,
|
| + bool result) OVERRIDE {
|
| switch (impl->active_tree()->source_frame_number()) {
|
| case 1:
|
| EXPECT_EQ(first_output_surface_memory_limit_,
|
| impl->memory_allocation_limit_bytes());
|
| // Lose the output surface.
|
| first_context_provider_->TestContext3d()->loseContextCHROMIUM(
|
| - GL_GUILTY_CONTEXT_RESET_ARB,
|
| - GL_INNOCENT_CONTEXT_RESET_ARB);
|
| + GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
|
| break;
|
| case 4:
|
| EXPECT_EQ(second_output_surface_memory_limit_,
|
| @@ -4572,11 +4515,11 @@ SINGLE_AND_MULTI_THREAD_TEST_F(
|
| LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface);
|
|
|
| struct TestSwapPromiseResult {
|
| - TestSwapPromiseResult() : did_swap_called(false),
|
| - did_not_swap_called(false),
|
| - dtor_called(false),
|
| - reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {
|
| - }
|
| + TestSwapPromiseResult()
|
| + : did_swap_called(false),
|
| + did_not_swap_called(false),
|
| + dtor_called(false),
|
| + reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {}
|
|
|
| bool did_swap_called;
|
| bool did_not_swap_called;
|
| @@ -4587,9 +4530,7 @@ struct TestSwapPromiseResult {
|
|
|
| class TestSwapPromise : public SwapPromise {
|
| public:
|
| - explicit TestSwapPromise(TestSwapPromiseResult* result)
|
| - : result_(result) {
|
| - }
|
| + explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {}
|
|
|
| virtual ~TestSwapPromise() {
|
| base::AutoLock lock(result_->lock);
|
| @@ -4616,17 +4557,15 @@ class TestSwapPromise : public SwapPromise {
|
| TestSwapPromiseResult* result_;
|
| };
|
|
|
| -class LayerTreeHostTestBreakSwapPromise
|
| - : public LayerTreeHostTest {
|
| +class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
|
| protected:
|
| LayerTreeHostTestBreakSwapPromise()
|
| - : commit_count_(0), commit_complete_count_(0) {
|
| - }
|
| + : commit_count_(0), commit_complete_count_(0) {}
|
|
|
| virtual void WillBeginMainFrame() OVERRIDE {
|
| ASSERT_LE(commit_count_, 2);
|
| - scoped_ptr<SwapPromise> swap_promise(new TestSwapPromise(
|
| - &swap_promise_result_[commit_count_]));
|
| + scoped_ptr<SwapPromise> swap_promise(
|
| + new TestSwapPromise(&swap_promise_result_[commit_count_]));
|
| layer_tree_host()->QueueSwapPromise(swap_promise.Pass());
|
| }
|
|
|
| @@ -4691,7 +4630,6 @@ class LayerTreeHostTestBreakSwapPromise
|
|
|
| MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
|
|
|
| -
|
| class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
|
| public:
|
| SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
|
| @@ -4717,9 +4655,8 @@ class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
|
| int* set_needs_redraw_count_;
|
| };
|
|
|
| -class LayerTreeHostTestSimpleSwapPromiseMonitor
|
| - : public LayerTreeHostTest {
|
| -
|
| +class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest {
|
| + public:
|
| virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
|
|
| virtual void WillBeginMainFrame() OVERRIDE {
|
|
|