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

Unified Diff: cc/trees/layer_tree_host_unittest_proxy.cc

Issue 1418953002: cc: Send shared variables between main and impl side using the channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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/channel_main.h ('k') | cc/trees/proxy_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_proxy.cc
diff --git a/cc/trees/layer_tree_host_unittest_proxy.cc b/cc/trees/layer_tree_host_unittest_proxy.cc
index d4057cfa10a2a17ba9f8f246f4be0e4a3bda724a..370760e0cf687409dee84f5152c163ee5603d5ec 100644
--- a/cc/trees/layer_tree_host_unittest_proxy.cc
+++ b/cc/trees/layer_tree_host_unittest_proxy.cc
@@ -287,4 +287,66 @@ class ThreadProxyTestSetNeedsCommitWhileAnimating : public ThreadProxyTest {
THREAD_PROXY_TEST_F(ThreadProxyTestSetNeedsCommitWhileAnimating);
+class ThreadProxyTestCommitWaitsForActivation : public ThreadProxyTest {
+ protected:
+ ThreadProxyTestCommitWaitsForActivation() : commits_completed_(0) {}
+ ~ThreadProxyTestCommitWaitsForActivation() override {}
+
+ void BeginTest() override { proxy()->SetNeedsCommit(); }
+
+ void ScheduledActionCommit() override {
+ switch (commits_completed_) {
+ case 0:
+ // The first commit does not wait for activation. Verify that the
+ // completion event is cleared.
+ EXPECT_FALSE(ThreadProxyImplOnly().commit_completion_event);
+ EXPECT_FALSE(ThreadProxyImplOnly().next_commit_waits_for_activation);
+ break;
+ case 1:
+ // The second commit should be held until activation.
+ EXPECT_TRUE(ThreadProxyImplOnly().commit_completion_event);
+ EXPECT_TRUE(ThreadProxyImplOnly().next_commit_waits_for_activation);
+ break;
+ case 2:
+ // The third commit should not wait for activation.
+ EXPECT_FALSE(ThreadProxyImplOnly().commit_completion_event);
+ EXPECT_FALSE(ThreadProxyImplOnly().next_commit_waits_for_activation);
+ }
+ }
+
+ void DidActivateSyncTree() override {
+ // The next_commit_waits_for_activation should have been cleared after the
+ // sync tree is activated.
+ EXPECT_FALSE(ThreadProxyImplOnly().next_commit_waits_for_activation);
+ }
+
+ void DidCommit() override {
+ switch (commits_completed_) {
+ case 0:
+ // The first commit has been completed. Set next commit waits for
+ // activation and start another commit.
+ commits_completed_++;
+ proxy()->SetNextCommitWaitsForActivation();
+ proxy()->SetNeedsCommit();
+ case 1:
+ // Start another commit to verify that this is not held until
+ // activation.
+ commits_completed_++;
+ proxy()->SetNeedsCommit();
+ case 2:
+ commits_completed_++;
+ EndTest();
+ }
+ }
+
+ void AfterTest() override { EXPECT_EQ(3, commits_completed_); }
+
+ private:
+ int commits_completed_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestCommitWaitsForActivation);
+};
+
+THREAD_PROXY_TEST_F(ThreadProxyTestCommitWaitsForActivation);
+
} // namespace cc
« no previous file with comments | « cc/trees/channel_main.h ('k') | cc/trees/proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698