Chromium Code Reviews| 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 129aeca9bf265c698e797cdc0d685f236ed4aa78..1d5231706ee9d49223f8f34c1a637822629bba22 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -452,7 +452,10 @@ class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { |
| // 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_, ClientBecameVisible()) |
| + .WillOnce( |
| + ::testing::Invoke(mock_context_support_ptr_, |
| + &MockContextSupport::SuperClientBecameVisible)); |
| EXPECT_CALL(*mock_context_support_ptr_, AnyClientsVisible()) |
| .WillOnce(::testing::Return(true)); |
| EXPECT_CALL(*mock_context_support_ptr_, |
| @@ -479,7 +482,11 @@ class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { |
| // 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_, |
| + ClientBecameNotVisible_(::testing::_)) |
|
danakj
2016/08/18 21:39:44
just _, add a call to using if needed
ericrk
2016/08/19 17:23:19
Done.
|
| + .WillOnce(::testing::Invoke( |
| + mock_context_support_ptr_, |
| + &MockContextSupport::SuperClientBecameNotVisible)); |
| EXPECT_CALL(*mock_context_support_ptr_, AnyClientsVisible()) |
| .WillOnce(::testing::Return(false)); |
| EXPECT_CALL(*mock_context_provider_ptr_, DeleteCachedResources()); |
| @@ -509,11 +516,27 @@ class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { |
| class MockContextSupport : public TestContextSupport { |
| public: |
| + using VisibilityToken = std::unique_ptr<ScopedVisibility>; |
| MockContextSupport() {} |
| MOCK_METHOD1(SetAggressivelyFreeResources, |
| void(bool aggressively_free_resources)); |
| - MOCK_METHOD2(SetClientVisible, void(int client_id, bool is_visible)); |
| + MOCK_METHOD0(ClientBecameVisible, VisibilityToken()); |
| + MOCK_METHOD1(ClientBecameNotVisible_, |
| + void(VisibilityToken& visibility)); // NOLINT |
| MOCK_CONST_METHOD0(AnyClientsVisible, bool()); |
| + |
| + // Wrapper to allow mocking w/ move-only type. |
| + void ClientBecameNotVisible(VisibilityToken visibility) override { |
| + ClientBecameNotVisible_(visibility); |
| + } |
| + |
| + // Wrappers to allow forwarding to super class implementation. |
| + void SuperClientBecameNotVisible(VisibilityToken& visibility) { // NOLINT |
| + TestContextSupport::ClientBecameNotVisible(std::move(visibility)); |
| + } |
| + VisibilityToken SuperClientBecameVisible() { |
| + return TestContextSupport::ClientBecameVisible(); |
| + } |
| }; |
| MockContextSupport* mock_context_support_ptr_; |