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

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 review comments. Created 5 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/trees/layer_tree_host_impl.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 be879af1384d097e5b7d9ef53ec4ea1603c10248..4feaa3e86c5827ebacf9813365ddb73c962641ed 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2283,7 +2283,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:
@@ -5493,6 +5494,72 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting);
+class LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame
+ : public LayerTreeHostTest {
+ public:
+ enum { kExpectedNumImplFrames = 10 };
+
+ LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame()
+ : threaded_(false),
+ will_begin_impl_frame_count_(0),
+ did_begin_impl_frame_finish_count_(0) {}
sunnyps 2015/05/01 20:35:25 nit: did_finish_impl_frame_count_
mithro-old 2015/05/04 01:22:58 Done! Me English good :P
+
+ void RunTest(bool threaded,
+ bool delegating_renderer,
+ bool impl_side_painting) override {
+ threaded_ = threaded;
+ LayerTreeHostTest::RunTest(threaded, delegating_renderer,
+ impl_side_painting);
+ }
+
+ 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_begin_impl_frame_finish_count_);
+ EXPECT_FALSE(TestEnded());
+ will_begin_impl_frame_count_++;
+ }
+
+ void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) override {
+ did_begin_impl_frame_finish_count_++;
+ EXPECT_EQ(will_begin_impl_frame_count_, did_begin_impl_frame_finish_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_begin_impl_frame_finish_count_ < kExpectedNumImplFrames - 1)
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void SendBeginMainFrameNotExpectedSoon() override { EndTest(); }
+
+ void AfterTest() override {
+ EXPECT_GT(will_begin_impl_frame_count_, 0);
+ EXPECT_GT(did_begin_impl_frame_finish_count_, 0);
+ EXPECT_EQ(will_begin_impl_frame_count_, did_begin_impl_frame_finish_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 (!threaded_) {
+ EXPECT_EQ(will_begin_impl_frame_count_, kExpectedNumImplFrames);
+ EXPECT_EQ(did_begin_impl_frame_finish_count_, kExpectedNumImplFrames);
sunnyps 2015/05/01 20:35:25 Can we at least check EXPECT_EQ(will_begin_impl_fr
mithro-old 2015/05/04 01:22:58 Line 5543 above does this.
+ }
+ }
+
+ private:
+ bool threaded_;
+ int will_begin_impl_frame_count_;
+ int did_begin_impl_frame_finish_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.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698