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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2398283002: Fix flakiness in LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated (Closed)
Patch Set: OutputSurface > CompositorFrameSink Created 4 years, 2 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 2a9f8eb9ebd2a5dfe1e1e96e8e031ac7fd0f416a..b2c43e1b767c4cc9607bee68485be220047a7775 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -573,35 +573,36 @@ class LayerTreeHostFreeContextResourcesOnDestroy
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostFreeContextResourcesOnDestroy);
// Test if the LTH successfully frees and stops freeing context resources
-// when the OutputSurface is lost and recreated.
-class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated
+// when the CompositorFrameSink is lost and recreated.
+class LayerTreeHostCacheBehaviorOnCompositorFrameSinkRecreated
: public LayerTreeHostContextCacheTest {
public:
void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
const BeginFrameArgs& args) override {
- // This code is run once, to trigger recreation of our OutputSurface.
- if (has_recreated_)
+ // This code is run once, to trigger recreation of our CompositorFrameSink.
+ if (test_state_ != TestState::INIT)
return;
// Ensure that our initialization expectations have completed.
Mock::VerifyAndClearExpectations(mock_main_context_support_);
Mock::VerifyAndClearExpectations(mock_worker_context_support_);
- // Output surface lost expectations.
+ // CompositorFrameSink lost expectations.
EXPECT_CALL(*mock_worker_context_support_,
SetAggressivelyFreeResources(true));
EXPECT_CALL(*mock_main_context_support_,
SetAggressivelyFreeResources(true));
host_impl->DidLoseCompositorFrameSink();
- has_recreated_ = true;
+ test_state_ = TestState::RECREATED;
}
- void DidInitializeCompositorFrameSink() override {
- // This is run after we have recreated our OutputSurface.
- if (!has_recreated_)
+ void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
+ bool success) override {
+ // This is run after we have recreated our CompositorFrameSink.
+ if (test_state_ != TestState::RECREATED)
return;
- // Ensure that our initialization expectations have completed.
+ // Ensure that our expectations have completed.
Mock::VerifyAndClearExpectations(mock_main_context_support_);
Mock::VerifyAndClearExpectations(mock_worker_context_support_);
@@ -611,14 +612,16 @@ class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated
EXPECT_CALL(*mock_main_context_support_,
SetAggressivelyFreeResources(true));
EndTest();
+ test_state_ = TestState::DONE;
}
private:
- bool has_recreated_ = false;
+ enum class TestState { INIT, RECREATED, DONE };
+ TestState test_state_ = TestState::INIT;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
- LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated);
+ LayerTreeHostCacheBehaviorOnCompositorFrameSinkRecreated);
// Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
// draw with frame 0.
« 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