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..0e94353864d1973ced23f318ea61ae2eb9d5f518 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. |
class LayerTreeHostProxyTestCommitWaitsForActivationMFBA |
: public LayerTreeHostProxyTest { |
protected: |
@@ -420,4 +416,59 @@ class LayerTreeHostProxyTestCommitWaitsForActivationMFBA |
MULTI_THREAD_TEST_F(LayerTreeHostProxyTestCommitWaitsForActivationMFBA); |
+// Test for activation time passed in BeginFrameArgs. |
+class LayerTreeHostProxyTestActivationTime : public LayerTreeHostProxyTest { |
brianderson
2017/04/13 22:36:37
I think you'll want to delay activation until afte
panicker
2017/04/14 22:02:45
Not sure how this would work, when activation is b
brianderson
2017/04/14 23:34:28
============
Re: test for two ready_to_activate_ti
|
+ protected: |
+ LayerTreeHostProxyTestActivationTime() = default; |
+ |
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
+ |
+ void DidBeginMainFrame() override { |
+ BeginFrameArgs bfargs = GetProxyMain()->BeginFrameArgsForTesting(); |
+ switch (bfargs.source_frame_number) { |
+ case 0: |
+ // Initial frame, no activation yet. |
+ EXPECT_EQ(0UL, bfargs.ready_to_activate_time.size()); |
+ break; |
+ case 1: |
+ // Frame #1, since activation was delayed, nothing here yet. |
panicker
2017/04/13 22:09:22
I didn't actually delay this (I removed the delay
brianderson
2017/04/13 22:36:37
It could be since there's a race between whether a
panicker
2017/04/14 22:02:45
I've added back the explicit delay to make this de
|
+ EXPECT_EQ(0UL, bfargs.ready_to_activate_time.size()); |
+ break; |
+ case 2: |
+ // Frame #2, activation for Frame #1 |
+ EXPECT_EQ(1UL, bfargs.ready_to_activate_time.size()); |
+ EXPECT_EQ(1UL, bfargs.ready_to_activate_time.begin()->first); |
+ break; |
+ case 3: |
+ // Frame #3, activation for Frame #2 |
+ EXPECT_EQ(1UL, bfargs.ready_to_activate_time.size()); |
+ EXPECT_EQ(2UL, bfargs.ready_to_activate_time.begin()->first); |
+ EndTest(); |
+ } |
+ } |
+ |
+ void DidCommit() override { |
+ switch (layer_tree_host()->SourceFrameNumber()) { |
+ case 1: |
+ // Request a new commit. |
+ layer_tree_host()->SetNeedsCommit(); |
+ break; |
+ case 2: |
+ // Request a new commit. |
+ layer_tree_host()->SetNeedsCommit(); |
+ break; |
+ case 3: |
+ layer_tree_host()->SetNeedsCommit(); |
+ break; |
+ } |
+ } |
+ |
+ void AfterTest() override {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(LayerTreeHostProxyTestActivationTime); |
+}; |
+ |
+MULTI_THREAD_TEST_F(LayerTreeHostProxyTestActivationTime); |
+ |
} // namespace cc |