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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1111743002: cc: Adding DidFinishImplFrame to LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing surfaces_scheduler. Created 5 years, 7 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/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.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.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index f2ed38e5fa409c2e0841a8d43d7eea03190732a4..ab406844c3bd130f8839d39c148c40cc70e05ac9 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2308,7 +2308,8 @@ class LayerTreeHostTestDeferCommits : public LayerTreeHostTest {
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- void WillBeginImplFrame(const BeginFrameArgs& args) override {
+ void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
+ const BeginFrameArgs& args) override {
num_will_begin_impl_frame_++;
switch (num_will_begin_impl_frame_) {
case 1:
@@ -5512,6 +5513,61 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting);
+class LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame
+ : public LayerTreeHostTest {
+ public:
+ enum { kExpectedNumImplFrames = 10 };
+
+ LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame()
+ : will_begin_impl_frame_count_(0), did_finish_impl_frame_count_(0) {}
+
+ void BeginTest() override {
+ // Kick off the test with a commit.
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
+ const BeginFrameArgs& args) override {
+ EXPECT_EQ(will_begin_impl_frame_count_, did_finish_impl_frame_count_);
+ EXPECT_FALSE(TestEnded());
+ will_begin_impl_frame_count_++;
+ }
+
+ void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) override {
+ did_finish_impl_frame_count_++;
+ EXPECT_EQ(will_begin_impl_frame_count_, did_finish_impl_frame_count_);
+
+ // Request a number of commits to cause multiple impl frames. We expect to
+ // get one more impl frames than the number of commits requested because
+ // after a commit it takes one frame to become idle.
+ if (did_finish_impl_frame_count_ < kExpectedNumImplFrames - 1)
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void SendBeginMainFrameNotExpectedSoon() override { EndTest(); }
+
+ void AfterTest() override {
+ EXPECT_GT(will_begin_impl_frame_count_, 0);
+ EXPECT_GT(did_finish_impl_frame_count_, 0);
+ EXPECT_EQ(will_begin_impl_frame_count_, did_finish_impl_frame_count_);
+
+ // TODO(mithro): Figure out why the multithread version of this test
+ // sometimes has one more frame then expected. Possibly related to
+ // http://crbug.com/443185
+ if (!HasImplThread()) {
+ EXPECT_EQ(will_begin_impl_frame_count_, kExpectedNumImplFrames);
+ EXPECT_EQ(did_finish_impl_frame_count_, kExpectedNumImplFrames);
+ }
+ }
+
+ private:
+ int will_begin_impl_frame_count_;
+ int did_finish_impl_frame_count_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame);
+
class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest {
public:
LayerTreeHostTestSendBeginFramesToChildren()
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698