New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 628465 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

LayerTreeHostFreeWorkerContextResourcesTest is not run and fails

Project Member Reported by danakj@chromium.org, Jul 15 2016

Issue description

The test has no SINGLE_AND_MULTI_THREAD_TEST_F macro for it, so no tests are generated from the class.

I tried adding one, and the tests just time out. I was modifying the test and found the mock expectations are wrong also if i made it not time out. The first one is called twice, instead of once. And the second one is not called.

We should test this in a way that isn't using a mock OutputSurface. FWIW here's what I was playing with. But I wonder if this should really be a LayerTreeTest or what..

class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
 public:
  std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface() override {
    auto compositor_context_provider = TestContextProvider::Create();
    auto worker_context_support_owned = base::MakeUnique<MockContextSupport>();
    auto* worker_context_support = worker_context_support_owned.get();
    auto worker_context_provider_owned = make_scoped_refptr(new MockContextProvider(
        std::move(worker_context_support_owned)));
    auto* worker_context_provider = worker_context_provider_owned.get();
  
    // Workers are bound on the main thread.                                                                                   
    worker_context_provider_owned->BindToCurrentThread();

    // At init, we expect one call to set visibility to true.                                                                  
    testing::Expectation visibility_true =
        EXPECT_CALL(*worker_context_support,
                    SetAggressivelyFreeResources(false)).Times(2);

    // After running, we should get exactly one call to                                                                        
    // DeleteCachedResources, along with SetAggressivelyFreeResources.                                                         
    EXPECT_CALL(*worker_context_provider, DeleteCachedResources())
        .After(visibility_true);
    EXPECT_CALL(*worker_context_support,
                SetAggressivelyFreeResources(true))
        .After(visibility_true);
  
    called_ = true;
    return CreateDelegatingOutputSurfaceWithContexts(
        std::move(compositor_context_provider),
        std::move(worker_context_provider_owned));
  }

  void InitializeSettings(LayerTreeSettings* settings) override {
    settings->gpu_rasterization_enabled = true;
    settings->gpu_rasterization_forced = true;
  }

  void BeginTest() override {
    PostSetNeedsCommitToMainThread();
  }
  
  void DidCommit() override {
    EndTest();
  }

  void AfterTest() override {
    EXPECT_TRUE(called_);
  }

 private:
  bool called_ = false;
  
  class MockContextProvider : public TestContextProvider {
   public:
    explicit MockContextProvider(std::unique_ptr<TestContextSupport> support)
        : TestContextProvider(TestWebGraphicsContext3D::Create(),
                              std::move(support)) {}

    MOCK_METHOD0(DeleteCachedResources, void());
   
   private:
    ~MockContextProvider() = default;
  };
  
  class MockContextSupport : public TestContextSupport {
   public:
    MOCK_METHOD1(SetAggressivelyFreeResources, void(bool aggressively_free_resources));
  };
};

SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostFreeWorkerContextResourcesTest);

 

Comment 1 by danakj@chromium.org, Jul 15 2016

Components: Internals>Compositing>Rasterization

Comment 2 by danakj@chromium.org, Jul 15 2016

Status: WontFix (was: Assigned)
Oh.. there are subclasses of it. But it has BeforeTest/AfterTest so that confused me. OKAY

Sign in to add a comment