| 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 363e8e2e204d22348fbae5554081a2b8ade4d013..5b43dab8c8b4402918712359d642c35ee917450a 100644
|
| --- a/cc/trees/layer_tree_host_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_unittest.cc
|
| @@ -440,27 +440,21 @@ class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
|
| base::MakeUnique<MockContextSupport>();
|
| mock_context_support_ptr_ = mock_worker_context_support_owned.get();
|
|
|
| - auto mock_worker_context_provider = make_scoped_refptr(
|
| - new MockContextProvider(std::move(mock_worker_context_support_owned)));
|
| - mock_context_provider_ptr_ = mock_worker_context_provider.get();
|
| + auto test_worker_context_provider = TestContextProvider::Create(
|
| + TestWebGraphicsContext3D::Create(),
|
| + std::move(mock_worker_context_support_owned));
|
|
|
| // Workers are bound on the main thread.
|
| - mock_worker_context_provider->BindToCurrentThread();
|
| -
|
| - // Ensure that our mock calls execute in sequence.
|
| - ::testing::InSequence s;
|
| + test_worker_context_provider->BindToCurrentThread();
|
|
|
| // At init, visibility is set to true and we will call
|
| // SetAggressivelyFreeResources(false).
|
| - EXPECT_CALL(*mock_context_support_ptr_, SetClientVisible(0, true));
|
| - EXPECT_CALL(*mock_context_support_ptr_, AnyClientsVisible())
|
| - .WillOnce(::testing::Return(true));
|
| EXPECT_CALL(*mock_context_support_ptr_,
|
| SetAggressivelyFreeResources(false));
|
|
|
| return LayerTreeHostTest::CreateDelegatingOutputSurface(
|
| std::move(compositor_context_provider),
|
| - std::move(mock_worker_context_provider));
|
| + std::move(test_worker_context_provider));
|
| }
|
|
|
| void InitializeSettings(LayerTreeSettings* settings) override {
|
| @@ -474,15 +468,8 @@ class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
|
| // Ensure that our initialization expectations have completed.
|
| Mock::VerifyAndClearExpectations(mock_context_support_ptr_);
|
|
|
| - // Ensure that our mock calls execute in sequence.
|
| - ::testing::InSequence s;
|
| -
|
| // While running, visibility is set to false, and we will call
|
| - // DeleteCachedResources and SetAggressivelyFreeResources(true).
|
| - EXPECT_CALL(*mock_context_support_ptr_, SetClientVisible(0, false));
|
| - EXPECT_CALL(*mock_context_support_ptr_, AnyClientsVisible())
|
| - .WillOnce(::testing::Return(false));
|
| - EXPECT_CALL(*mock_context_provider_ptr_, DeleteCachedResources());
|
| + // SetAggressivelyFreeResources(true).
|
| EXPECT_CALL(*mock_context_support_ptr_, SetAggressivelyFreeResources(true))
|
| .WillOnce(testing::Invoke([this](bool is_visible) { EndTest(); }));
|
| }
|
| @@ -490,34 +477,17 @@ class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
|
| void AfterTest() override {
|
| // Ensure all expectations are satisfied.
|
| Mock::VerifyAndClearExpectations(mock_context_support_ptr_);
|
| - Mock::VerifyAndClearExpectations(mock_context_provider_ptr_);
|
| }
|
|
|
| private:
|
| - class MockContextProvider : public TestContextProvider {
|
| - public:
|
| - explicit MockContextProvider(std::unique_ptr<TestContextSupport> support)
|
| - : TestContextProvider(std::move(support),
|
| - base::MakeUnique<TestGLES2Interface>(),
|
| - TestWebGraphicsContext3D::Create()) {}
|
| -
|
| - MOCK_METHOD0(DeleteCachedResources, void());
|
| -
|
| - private:
|
| - ~MockContextProvider() = default;
|
| - };
|
| -
|
| class MockContextSupport : public TestContextSupport {
|
| public:
|
| MockContextSupport() {}
|
| MOCK_METHOD1(SetAggressivelyFreeResources,
|
| void(bool aggressively_free_resources));
|
| - MOCK_METHOD2(SetClientVisible, void(int client_id, bool is_visible));
|
| - MOCK_CONST_METHOD0(AnyClientsVisible, bool());
|
| };
|
|
|
| MockContextSupport* mock_context_support_ptr_;
|
| - MockContextProvider* mock_context_provider_ptr_;
|
| };
|
|
|
| // Test if the LTH successfully frees resources on the worker context when
|
|
|