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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_no_message_loop.cc » ('j') | 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 eee6275e9cc9ba7f7713f59e21fb3182f5c11d9c..81ce1fa06bf08cebe7d319ee46087e527b60c262 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2506,7 +2506,7 @@ class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest {
}
void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
- bool did_handle) override {
+ CommitEarlyOutReason reason) override {
commit_abort_count_++;
// Initiate another abortable commit.
host_impl->SetNeedsCommit();
@@ -4786,7 +4786,7 @@ class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit
}
void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
- bool did_handle) override {
+ CommitEarlyOutReason reason) override {
EndTest();
}
@@ -4827,7 +4827,7 @@ class LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit
}
void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
- bool did_handle) override {
+ CommitEarlyOutReason reason) override {
// This is needed so that the impl-thread state matches main-thread state.
host_impl->DidLoseOutputSurface();
EndTest();
@@ -5958,4 +5958,41 @@ class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest {
MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles);
+// This tests an assertion that DidCommit and WillCommit happen in the same
+// stack frame with no tasks that run between them. Various embedders of
+// cc depend on this logic. ui::Compositor holds a compositor lock between
+// these events and the inspector timeline wants begin/end CompositeLayers
+// to be properly nested with other begin/end events.
+class LayerTreeHostTestNoTasksBetweenWillAndDidCommit
+ : public LayerTreeHostTest {
+ public:
+ LayerTreeHostTestNoTasksBetweenWillAndDidCommit() : did_commit_(false) {}
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void WillCommit() override {
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&LayerTreeHostTestNoTasksBetweenWillAndDidCommit::
+ EndTestShouldRunAfterDidCommit,
+ base::Unretained(this)));
+ }
+
+ void EndTestShouldRunAfterDidCommit() {
+ EXPECT_TRUE(did_commit_);
+ EndTest();
+ }
+
+ void DidCommit() override {
+ EXPECT_FALSE(did_commit_);
+ did_commit_ = true;
+ }
+
+ void AfterTest() override { EXPECT_TRUE(did_commit_); }
+
+ private:
+ bool did_commit_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
+
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_no_message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698