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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2297413002: Fix LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated test (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 248d766a694f4ef936daa95909394ae99c556afe..39e7a517b6151d278e71638bd862e6cc340facfd 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -576,27 +576,38 @@ class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated
public:
void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
const BeginFrameArgs& args) override {
+ // This code is run once, to trigger recreation of our OutputSurface.
+ if (has_recreated_)
+ return;
+
// Ensure that our initialization expectations have completed.
Mock::VerifyAndClearExpectations(mock_main_context_support_);
Mock::VerifyAndClearExpectations(mock_worker_context_support_);
- if (has_recreated_) {
- // Destruction exptectations.
- EXPECT_CALL(*mock_worker_context_support_,
- SetAggressivelyFreeResources(true));
- EXPECT_CALL(*mock_main_context_support_,
- SetAggressivelyFreeResources(true));
- EndTest();
- return;
- }
- has_recreated_ = true;
-
// Output surface lost expectations.
EXPECT_CALL(*mock_worker_context_support_,
SetAggressivelyFreeResources(true));
EXPECT_CALL(*mock_main_context_support_,
SetAggressivelyFreeResources(true));
host_impl->DidLoseOutputSurface();
+ has_recreated_ = true;
+ }
+
+ void DidInitializeOutputSurface() override {
+ // This is run after we have recreated our OutputSurface.
+ if (!has_recreated_)
+ return;
+
+ // Ensure that our initialization expectations have completed.
+ Mock::VerifyAndClearExpectations(mock_main_context_support_);
+ Mock::VerifyAndClearExpectations(mock_worker_context_support_);
+
+ // Destruction exptectations.
+ EXPECT_CALL(*mock_worker_context_support_,
+ SetAggressivelyFreeResources(true));
+ EXPECT_CALL(*mock_main_context_support_,
+ SetAggressivelyFreeResources(true));
+ EndTest();
}
private:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698