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

Unified Diff: cc/trees/remote_channel_unittest.cc

Issue 2042433002: cc: Fix flaky RemoteChannelTest.ReleaseOutputSurfaceDuringCommit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/remote_channel_unittest.cc
diff --git a/cc/trees/remote_channel_unittest.cc b/cc/trees/remote_channel_unittest.cc
index faa83160dbed7f4f9b9905a95a99de5faa390ef5..81ec63776dda5b046e823c5810be83dea429d59e 100644
--- a/cc/trees/remote_channel_unittest.cc
+++ b/cc/trees/remote_channel_unittest.cc
@@ -206,35 +206,47 @@ class RemoteChannelTestReleaseOutputSurfaceDuringCommit
void DidInitializeOutputSurface() override {
++output_surface_initialized_count_;
- // We should not have any commits at this point. This call runs either after
- // the first output surface is initialized so no commits should have been
- // started, or after the output surface was released by the main thread. In
- // which case, we should have queued the commit and it should only go
- // through after the new output surface is initialized.
- EXPECT_EQ(0, commit_count_);
+ switch (output_surface_initialized_count_) {
+ case 1:
+ // No commits can be performed before the first output surface is
+ // initialized. The Scheduler should not send BeginMainFrames.
+ EXPECT_EQ(0, commit_count_);
+ break;
+ case 2:
+ // When the first BeginMainFrame is received on the server, we release
+ // the output surface on the client. The RemoteChannelImpl on the client
+ // will queue the commit received till a new output surface is
+ // initialized, so we shouldn't see any commits till a second output
+ // surface is provided to the LTH.
+ EXPECT_EQ(0, commit_count_);
+ break;
+ }
}
void ReceivedBeginMainFrame() override {
- // Release the output surface before we respond to the BeginMainFrame.
- SetVisibleOnLayerTreeHost(false);
- ReleaseOutputSurfaceOnLayerTreeHost();
- SetVisibleOnLayerTreeHost(true);
+ if (commit_count_ == 0) {
+ // Release the output surface before we respond to the BeginMainFrame.
+ // We perform the test only for the first BeginMainFrame request.
+ SetVisibleOnLayerTreeHost(false);
+ ReleaseOutputSurfaceOnLayerTreeHost();
+ SetVisibleOnLayerTreeHost(true);
+ }
}
void StartCommitOnImpl() override {
- // The commit should go through only when the second output surface is
- // initialized.
- EXPECT_EQ(2, output_surface_initialized_count_);
- EXPECT_EQ(0, commit_count_);
++commit_count_;
- EndTest();
+ if (commit_count_ == 1) {
+ // If this is the first commit, then the output surface must have been
+ // initialized twice.
+ EXPECT_EQ(2, output_surface_initialized_count_);
+ EndTest();
+ }
}
- void AfterTest() override {
- EXPECT_EQ(2, output_surface_initialized_count_);
- EXPECT_EQ(1, commit_count_);
- }
+ void AfterTest() override {}
+ // Accessed on the main thread and the impl thread, when the main thread is
+ // blocked.
int output_surface_initialized_count_;
int commit_count_;
};
« 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