Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1530)

Unified Diff: cc/output/gl_renderer_unittest.cc

Issue 2252163003: Update Context Client Visibility to use Scoped Pattern (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix webview Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/test/test_context_support.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d5556f13d7ba7c9dd541f97e4fceb2092c69c7bb 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -2098,11 +2098,25 @@ 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,18 +2147,21 @@ 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_(_))
+ .WillOnce(
+ ::testing::Invoke(context_support_ptr_,
+ &MockContextSupport::SuperClientBecameNotVisible));
EXPECT_CALL(*context_support_ptr_, AnyClientsVisible())
.WillOnce(Return(false));
EXPECT_CALL(*context_provider_, DeleteCachedResources());
- EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true));
renderer_->SetVisible(false);
Mock::VerifyAndClearExpectations(context_support_ptr_);
}
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/test/test_context_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698