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

Unified Diff: cc/trees/layer_tree_host_unittest_proxy.cc

Issue 2778223005: Plumb activation time to main (Closed)
Patch Set: update test; remove test-only method in proxy_main Created 3 years, 8 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 | « cc/test/begin_frame_args_test.cc ('k') | cc/trees/proxy_impl.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_proxy.cc
diff --git a/cc/trees/layer_tree_host_unittest_proxy.cc b/cc/trees/layer_tree_host_unittest_proxy.cc
index 27e28354534959926f3078947f4d95cb6afe10bf..baddab2a2829d5f10dc71a3858a7a80b79bb1ac1 100644
--- a/cc/trees/layer_tree_host_unittest_proxy.cc
+++ b/cc/trees/layer_tree_host_unittest_proxy.cc
@@ -318,10 +318,6 @@ class LayerTreeHostProxyTestCommitWaitsForActivation
MULTI_THREAD_TEST_F(LayerTreeHostProxyTestCommitWaitsForActivation);
-// Test for a corner case of main frame before activation (MFBA) and commit
-// waits for activation. If a commit (with wait for activation flag set)
-// is ready before the activation for a previous commit then the activation
-// should not signal the completion event of the second commit.
brianderson 2017/04/17 22:26:33 Looks like this comment was accidentally removed.
panicker 2017/04/17 22:53:29 Done.
class LayerTreeHostProxyTestCommitWaitsForActivationMFBA
: public LayerTreeHostProxyTest {
protected:
@@ -420,4 +416,82 @@ class LayerTreeHostProxyTestCommitWaitsForActivationMFBA
MULTI_THREAD_TEST_F(LayerTreeHostProxyTestCommitWaitsForActivationMFBA);
+// Test for activation time passed in BeginFrameArgs.
+class LayerTreeHostProxyTestActivationTime : public LayerTreeHostProxyTest {
+ protected:
+ LayerTreeHostProxyTestActivationTime() = default;
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->main_frame_before_activation_enabled = true;
+ LayerTreeHostProxyTest::InitializeSettings(settings);
+ }
+
+ void DidSendBeginMainFrameOnThread(LayerTreeHostImpl* impl) override {
+ if (activate_blocked_) {
+ impl->BlockNotifyReadyToActivateForTesting(false);
+ {
+ base::AutoLock hold(activate_blocked_lock_);
+ activate_blocked_ = false;
+ }
+ }
+ }
+
+ void BeginMainFrame(const BeginFrameArgs& args) override {
+ {
+ base::AutoLock hold(activate_blocked_lock_);
+ EXPECT_FALSE(activate_blocked_);
brianderson 2017/04/17 22:26:33 Only expect during case 1.
panicker 2017/04/17 22:53:29 Acknowledged.
+ }
+ switch (args.source_frame_number) {
+ case 0:
+ // Initial frame, no activation yet.
+ EXPECT_EQ(0UL, args.ready_to_activate_time.size());
+ break;
+ case 1:
+ // Frame #1, activation is delayed in BeginCommitOnThread.
+ EXPECT_EQ(0UL, args.ready_to_activate_time.size());
+ break;
+ case 2:
+ // Frame #2, activation is delayed in BeginCommitOnThread.
+ EXPECT_EQ(0UL, args.ready_to_activate_time.size());
+ break;
+ case 3:
+ // Frame #3, received activation for first two frames.
+ EXPECT_EQ(2UL, args.ready_to_activate_time.size());
+ EXPECT_EQ(1UL, args.ready_to_activate_time[0].first);
panicker 2017/04/17 21:54:50 Hmm I think I expected this to be #0 vs. #1?
brianderson 2017/04/17 22:26:33 I think case 1 should have the #0 and case 3 shoul
panicker 2017/04/17 22:53:29 Acknowledged.
+ EXPECT_EQ(2UL, args.ready_to_activate_time[1].first);
+ EndTest();
+ }
+ }
+
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
+ if (impl->sync_tree()->source_frame_number() == 2)
brianderson 2017/04/17 22:26:33 || source_frame_number == 0.
panicker 2017/04/17 22:53:29 Done.
+ PostSetNeedsCommitToMainThread(); // invoke for frame 3
+ }
+
+ void BeginCommitOnThread(LayerTreeHostImpl* impl) override {
+ // Block activation for the first two frames
+ // and invoke PostSetNeedsCommitToMainThread for frame 1, 2
+ if (impl->sync_tree()->source_frame_number() <= 0) {
brianderson 2017/04/17 22:26:33 Change the method override to CommitCompleteOnThre
panicker 2017/04/17 22:53:29 Done.
+ impl->BlockNotifyReadyToActivateForTesting(true);
+ PostSetNeedsCommitToMainThread();
+ {
+ base::AutoLock hold(activate_blocked_lock_);
+ activate_blocked_ = true;
+ }
+ }
+ }
+
+ void AfterTest() override {}
+
+ private:
+ base::Lock activate_blocked_lock_;
+ bool activate_blocked_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(LayerTreeHostProxyTestActivationTime);
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostProxyTestActivationTime);
+
} // namespace cc
« no previous file with comments | « cc/test/begin_frame_args_test.cc ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698