Chromium Code Reviews| Index: cc/output/gl_renderer_unittest.cc |
| diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc |
| index f23ab4f3630823968cac9636716e5cad8b5ed000..0c35cf2382ac16b788e08d19d1a2786214dab01d 100644 |
| --- a/cc/output/gl_renderer_unittest.cc |
| +++ b/cc/output/gl_renderer_unittest.cc |
| @@ -2098,11 +2098,27 @@ class GLRendererWithMockContextTest : public ::testing::Test { |
| 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(); |
| + } |
| }; |
| void SetUp() override { |
| @@ -2133,14 +2149,19 @@ TEST_F(GLRendererWithMockContextTest, |
| // Ensure our expectations run in order. |
| ::testing::InSequence s; |
| - EXPECT_CALL(*context_support_ptr_, SetClientVisible(0, true)); |
| + EXPECT_CALL(*context_support_ptr_, ClientBecameVisible()) |
| + .WillOnce(::testing::Invoke( |
| + context_support_ptr_, &MockContextSupport::SuperClientBecameVisible)); |
| EXPECT_CALL(*context_support_ptr_, AnyClientsVisible()) |
| .WillOnce(Return(true)); |
| EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(false)); |
| renderer_->SetVisible(true); |
| Mock::VerifyAndClearExpectations(context_support_ptr_); |
| - EXPECT_CALL(*context_support_ptr_, SetClientVisible(0, false)); |
| + EXPECT_CALL(*context_support_ptr_, ClientBecameNotVisible_(::testing::_)) |
|
danakj
2016/08/18 21:39:44
just _, we using'd it at the top
ericrk
2016/08/19 17:23:18
Done.
|
| + .WillOnce( |
| + ::testing::Invoke(context_support_ptr_, |
| + &MockContextSupport::SuperClientBecameNotVisible)); |
| EXPECT_CALL(*context_support_ptr_, AnyClientsVisible()) |
| .WillOnce(Return(false)); |
| EXPECT_CALL(*context_provider_, DeleteCachedResources()); |