| Index: cc/trees/layer_tree_host_unittest_animation.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
|
| index 67fb6f81dc05750b817773139598d0e8969da916..cfd8a1489af4a06f045b1b817c18b83ed721c852 100644
|
| --- a/cc/trees/layer_tree_host_unittest_animation.cc
|
| +++ b/cc/trees/layer_tree_host_unittest_animation.cc
|
| @@ -21,7 +21,7 @@ namespace {
|
|
|
| class LayerTreeHostAnimationTest : public LayerTreeTest {
|
| public:
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeTest::SetupTree();
|
| layer_tree_host()->root_layer()->set_layer_animation_delegate(this);
|
| }
|
| @@ -35,11 +35,9 @@ class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested
|
| LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested()
|
| : num_commits_(0) {}
|
|
|
| - virtual void BeginTest() override {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void BeginMainFrame(const BeginFrameArgs& args) override {
|
| + void BeginMainFrame(const BeginFrameArgs& args) override {
|
| // We skip the first commit because its the commit that populates the
|
| // impl thread with a tree. After the second commit, the test is done.
|
| if (num_commits_ != 1)
|
| @@ -52,7 +50,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested
|
| // verify that CommitRequested has gone back to false.
|
| }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| if (!num_commits_) {
|
| EXPECT_FALSE(layer_tree_host()->CommitRequested());
|
| layer_tree_host()->SetNeedsAnimate();
|
| @@ -66,7 +64,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested
|
| num_commits_++;
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| int num_commits_;
|
| @@ -86,11 +84,9 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback
|
| LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback()
|
| : num_begin_frames_(0) {}
|
|
|
| - virtual void BeginTest() override {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void BeginMainFrame(const BeginFrameArgs& args) override {
|
| + void BeginMainFrame(const BeginFrameArgs& args) override {
|
| if (!num_begin_frames_) {
|
| layer_tree_host()->SetNeedsAnimate();
|
| num_begin_frames_++;
|
| @@ -99,7 +95,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| int num_begin_frames_;
|
| @@ -117,13 +113,12 @@ class LayerTreeHostAnimationTestAddAnimation
|
| LayerTreeHostAnimationTestAddAnimation()
|
| : num_begin_frames_(0), received_animation_started_notification_(false) {}
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| - virtual void UpdateAnimationState(
|
| - LayerTreeHostImpl* host_impl,
|
| - bool has_unfinished_animation) override {
|
| + void UpdateAnimationState(LayerTreeHostImpl* host_impl,
|
| + bool has_unfinished_animation) override {
|
| if (!num_begin_frames_) {
|
| // The animation had zero duration so LayerTreeHostImpl should no
|
| // longer need to animate its layers.
|
| @@ -146,9 +141,9 @@ class LayerTreeHostAnimationTestAddAnimation
|
| }
|
| }
|
|
|
| - virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| received_animation_started_notification_ = true;
|
| start_time_ = monotonic_time;
|
| if (num_begin_frames_) {
|
| @@ -165,7 +160,7 @@ class LayerTreeHostAnimationTestAddAnimation
|
| }
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| int num_begin_frames_;
|
| @@ -183,29 +178,27 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws
|
| LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws()
|
| : started_animating_(false) {}
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| - virtual void AnimateLayers(
|
| - LayerTreeHostImpl* host_impl,
|
| - base::TimeTicks monotonic_time) override {
|
| + void AnimateLayers(LayerTreeHostImpl* host_impl,
|
| + base::TimeTicks monotonic_time) override {
|
| started_animating_ = true;
|
| }
|
|
|
| - virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
|
| if (started_animating_)
|
| EndTest();
|
| }
|
|
|
| - virtual DrawResult PrepareToDrawOnThread(
|
| - LayerTreeHostImpl* host_impl,
|
| - LayerTreeHostImpl::FrameData* frame,
|
| - DrawResult draw_result) override {
|
| + DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| + LayerTreeHostImpl::FrameData* frame,
|
| + DrawResult draw_result) override {
|
| return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
|
| }
|
|
|
| - virtual void AfterTest() override { }
|
| + void AfterTest() override {}
|
|
|
| private:
|
| bool started_animating_;
|
| @@ -221,13 +214,12 @@ class LayerTreeHostAnimationTestAnimationsGetDeleted
|
| LayerTreeHostAnimationTestAnimationsGetDeleted()
|
| : started_animating_(false) {}
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| - virtual void AnimateLayers(
|
| - LayerTreeHostImpl* host_impl,
|
| - base::TimeTicks monotonic_time) override {
|
| + void AnimateLayers(LayerTreeHostImpl* host_impl,
|
| + base::TimeTicks monotonic_time) override {
|
| bool have_animations = !host_impl->animation_registrar()->
|
| active_animation_controllers().empty();
|
| if (!started_animating_ && have_animations) {
|
| @@ -239,16 +231,15 @@ class LayerTreeHostAnimationTestAnimationsGetDeleted
|
| EndTest();
|
| }
|
|
|
| - virtual void NotifyAnimationFinished(
|
| - base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationFinished(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| // Animations on the impl-side controller only get deleted during a commit,
|
| // so we need to schedule a commit.
|
| layer_tree_host()->SetNeedsCommit();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| bool started_animating_;
|
| @@ -263,16 +254,15 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
|
| LayerTreeHostAnimationTestTickAnimationWhileBackgrounded()
|
| : num_begin_frames_(0) {}
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddLongAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| // Use WillAnimateLayers to set visible false before the animation runs and
|
| // causes a commit, so we block the second visible animate in single-thread
|
| // mode.
|
| - virtual void WillAnimateLayers(
|
| - LayerTreeHostImpl* host_impl,
|
| - base::TimeTicks monotonic_time) override {
|
| + void WillAnimateLayers(LayerTreeHostImpl* host_impl,
|
| + base::TimeTicks monotonic_time) override {
|
| // Verify that the host can draw, it's just not visible.
|
| EXPECT_TRUE(host_impl->CanDraw());
|
| if (num_begin_frames_ < 2) {
|
| @@ -287,7 +277,7 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| int num_begin_frames_;
|
| @@ -305,18 +295,18 @@ class LayerTreeHostAnimationTestAnimationTickTimeIsMonotonic
|
| LayerTreeHostAnimationTestAnimationTickTimeIsMonotonic()
|
| : has_background_ticked_(false), num_foreground_animates_(0) {}
|
|
|
| - virtual void InitializeSettings(LayerTreeSettings* settings) override {
|
| + void InitializeSettings(LayerTreeSettings* settings) override {
|
| // Make sure that drawing many times doesn't cause a checkerboarded
|
| // animation to start so we avoid flake in this test.
|
| settings->timeout_and_draw_when_animation_checkerboards = false;
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddLongAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| - virtual void AnimateLayers(LayerTreeHostImpl* host_impl,
|
| - base::TimeTicks monotonic_time) override {
|
| + void AnimateLayers(LayerTreeHostImpl* host_impl,
|
| + base::TimeTicks monotonic_time) override {
|
| EXPECT_GE(monotonic_time, last_tick_time_);
|
| last_tick_time_ = monotonic_time;
|
| if (host_impl->visible()) {
|
| @@ -331,16 +321,15 @@ class LayerTreeHostAnimationTestAnimationTickTimeIsMonotonic
|
| }
|
| }
|
|
|
| - virtual DrawResult PrepareToDrawOnThread(
|
| - LayerTreeHostImpl* host_impl,
|
| - LayerTreeHostImpl::FrameData* frame,
|
| - DrawResult draw_result) override {
|
| + DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| + LayerTreeHostImpl::FrameData* frame,
|
| + DrawResult draw_result) override {
|
| if (TestEnded())
|
| return draw_result;
|
| return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| bool has_background_ticked_;
|
| @@ -359,23 +348,22 @@ class LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree
|
| LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree()
|
| : active_tree_was_animated_(false) {}
|
|
|
| - virtual base::TimeDelta LowFrequencyAnimationInterval() const override {
|
| + base::TimeDelta LowFrequencyAnimationInterval() const override {
|
| return base::TimeDelta::FromMilliseconds(4);
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| - virtual void NotifyAnimationFinished(
|
| - base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationFinished(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| // Replace animated commits with an empty tree.
|
| layer_tree_host()->SetRootLayer(make_scoped_refptr<Layer>(NULL));
|
| }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| // This alternates setting an empty tree and a non-empty tree with an
|
| // animation.
|
| switch (layer_tree_host()->source_frame_number()) {
|
| @@ -396,7 +384,7 @@ class LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree
|
| }
|
| }
|
|
|
| - virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
|
| // At the start of every commit, block activations and make sure
|
| // we are backgrounded.
|
| if (host_impl->settings().impl_side_painting)
|
| @@ -404,7 +392,7 @@ class LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree
|
| PostSetVisibleToMainThread(false);
|
| }
|
|
|
| - virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| if (!host_impl->settings().impl_side_painting) {
|
| // There are no activations to block if we're not impl-side-painting,
|
| // so just advance the test immediately.
|
| @@ -433,7 +421,7 @@ class LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree
|
| host_impl->BlockNotifyReadyToActivateForTesting(false);
|
| }
|
|
|
| - virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
|
| active_tree_was_animated_ = false;
|
|
|
| // Verify that commits are actually alternating with empty / non-empty
|
| @@ -466,8 +454,8 @@ class LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree
|
| }
|
| }
|
|
|
| - virtual void WillAnimateLayers(LayerTreeHostImpl* host_impl,
|
| - base::TimeTicks monotonic_time) override {
|
| + void WillAnimateLayers(LayerTreeHostImpl* host_impl,
|
| + base::TimeTicks monotonic_time) override {
|
| EXPECT_TRUE(host_impl->active_tree()->root_layer());
|
| active_tree_was_animated_ = true;
|
| }
|
| @@ -481,7 +469,7 @@ class LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree
|
| PostSetVisibleToMainThread(true);
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| bool active_tree_was_animated_;
|
| };
|
| @@ -495,20 +483,17 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
|
| public:
|
| LayerTreeHostAnimationTestAddAnimationWithTimingFunction() {}
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
| content_ = FakeContentLayer::Create(&client_);
|
| content_->SetBounds(gfx::Size(4, 4));
|
| layer_tree_host()->root_layer()->AddChild(content_);
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| - PostAddAnimationToMainThread(content_.get());
|
| - }
|
| + void BeginTest() override { PostAddAnimationToMainThread(content_.get()); }
|
|
|
| - virtual void AnimateLayers(
|
| - LayerTreeHostImpl* host_impl,
|
| - base::TimeTicks monotonic_time) override {
|
| + void AnimateLayers(LayerTreeHostImpl* host_impl,
|
| + base::TimeTicks monotonic_time) override {
|
| LayerAnimationController* controller_impl =
|
| host_impl->active_tree()->root_layer()->children()[0]->
|
| layer_animation_controller();
|
| @@ -532,7 +517,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| FakeContentLayerClient client_;
|
| scoped_refptr<FakeContentLayer> content_;
|
| @@ -550,7 +535,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
|
| : main_start_time_(-1.0),
|
| impl_start_time_(-1.0) {}
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
| content_ = FakeContentLayer::Create(&client_);
|
| content_->SetBounds(gfx::Size(4, 4));
|
| @@ -558,13 +543,11 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
|
| layer_tree_host()->root_layer()->AddChild(content_);
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| - PostAddAnimationToMainThread(content_.get());
|
| - }
|
| + void BeginTest() override { PostAddAnimationToMainThread(content_.get()); }
|
|
|
| - virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| LayerAnimationController* controller =
|
| layer_tree_host()->root_layer()->children()[0]->
|
| layer_animation_controller();
|
| @@ -578,9 +561,8 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
|
| EndTest();
|
| }
|
|
|
| - virtual void UpdateAnimationState(
|
| - LayerTreeHostImpl* impl_host,
|
| - bool has_unfinished_animation) override {
|
| + void UpdateAnimationState(LayerTreeHostImpl* impl_host,
|
| + bool has_unfinished_animation) override {
|
| LayerAnimationController* controller =
|
| impl_host->active_tree()->root_layer()->children()[0]->
|
| layer_animation_controller();
|
| @@ -597,7 +579,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| + void AfterTest() override {
|
| EXPECT_FLOAT_EQ(impl_start_time_, main_start_time_);
|
| }
|
|
|
| @@ -617,14 +599,13 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents
|
| public:
|
| LayerTreeHostAnimationTestAnimationFinishedEvents() {}
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer());
|
| }
|
|
|
| - virtual void NotifyAnimationFinished(
|
| - base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationFinished(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| LayerAnimationController* controller =
|
| layer_tree_host()->root_layer()->layer_animation_controller();
|
| Animation* animation =
|
| @@ -634,7 +615,7 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
| };
|
|
|
| SINGLE_AND_MULTI_THREAD_TEST_F(
|
| @@ -649,17 +630,17 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
|
| : update_check_layer_(FakeContentLayer::Create(&client_)) {
|
| }
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| update_check_layer_->SetOpacity(0.f);
|
| layer_tree_host()->SetRootLayer(update_check_layer_);
|
| LayerTreeHostAnimationTest::SetupTree();
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| PostAddAnimationToMainThread(update_check_layer_.get());
|
| }
|
|
|
| - virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
|
| LayerAnimationController* controller_impl =
|
| host_impl->active_tree()->root_layer()->layer_animation_controller();
|
| Animation* animation_impl =
|
| @@ -668,7 +649,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| + void AfterTest() override {
|
| // Update() should have been called once, proving that the layer was not
|
| // skipped.
|
| EXPECT_EQ(1u, update_check_layer_->update_count());
|
| @@ -692,11 +673,9 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation
|
| public:
|
| LayerTreeHostAnimationTestLayerAddedWithAnimation() {}
|
|
|
| - virtual void BeginTest() override {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| if (layer_tree_host()->source_frame_number() == 1) {
|
| scoped_refptr<Layer> layer = Layer::Create();
|
| layer->set_layer_animation_delegate(this);
|
| @@ -713,13 +692,12 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation
|
| }
|
| }
|
|
|
| - virtual void AnimateLayers(
|
| - LayerTreeHostImpl* impl_host,
|
| - base::TimeTicks monotonic_time) override {
|
| + void AnimateLayers(LayerTreeHostImpl* impl_host,
|
| + base::TimeTicks monotonic_time) override {
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
| };
|
|
|
| SINGLE_AND_MULTI_THREAD_TEST_F(
|
| @@ -731,9 +709,9 @@ class LayerTreeHostAnimationTestCancelAnimateCommit
|
| LayerTreeHostAnimationTestCancelAnimateCommit()
|
| : num_begin_frames_(0), num_commit_calls_(0), num_draw_calls_(0) {}
|
|
|
| - virtual void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void BeginMainFrame(const BeginFrameArgs& args) override {
|
| + void BeginMainFrame(const BeginFrameArgs& args) override {
|
| num_begin_frames_++;
|
| // No-op animate will cancel the commit.
|
| if (layer_tree_host()->source_frame_number() == 1) {
|
| @@ -743,19 +721,19 @@ class LayerTreeHostAnimationTestCancelAnimateCommit
|
| layer_tree_host()->SetNeedsAnimate();
|
| }
|
|
|
| - virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
|
| + void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
|
| num_commit_calls_++;
|
| if (impl->active_tree()->source_frame_number() > 1)
|
| FAIL() << "Commit should have been canceled.";
|
| }
|
|
|
| - virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
|
| + void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
|
| num_draw_calls_++;
|
| if (impl->active_tree()->source_frame_number() > 1)
|
| FAIL() << "Draw should have been canceled.";
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| + void AfterTest() override {
|
| EXPECT_EQ(2, num_begin_frames_);
|
| EXPECT_EQ(1, num_commit_calls_);
|
| EXPECT_EQ(1, num_draw_calls_);
|
| @@ -777,23 +755,21 @@ class LayerTreeHostAnimationTestForceRedraw
|
| LayerTreeHostAnimationTestForceRedraw()
|
| : num_animate_(0), num_draw_layers_(0) {}
|
|
|
| - virtual void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void BeginMainFrame(const BeginFrameArgs& args) override {
|
| + void BeginMainFrame(const BeginFrameArgs& args) override {
|
| if (++num_animate_ < 2)
|
| layer_tree_host()->SetNeedsAnimate();
|
| }
|
|
|
| - virtual void Layout() override {
|
| - layer_tree_host()->SetNextCommitForcesRedraw();
|
| - }
|
| + void Layout() override { layer_tree_host()->SetNextCommitForcesRedraw(); }
|
|
|
| - virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
|
| + void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
|
| if (++num_draw_layers_ == 2)
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| + void AfterTest() override {
|
| // The first commit will always draw; make sure the second draw triggered
|
| // by the animation was not cancelled.
|
| EXPECT_EQ(2, num_draw_layers_);
|
| @@ -813,21 +789,21 @@ class LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit
|
| LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit()
|
| : num_animate_(0), num_draw_layers_(0) {}
|
|
|
| - virtual void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void BeginMainFrame(const BeginFrameArgs& args) override {
|
| + void BeginMainFrame(const BeginFrameArgs& args) override {
|
| if (++num_animate_ <= 2) {
|
| layer_tree_host()->SetNeedsCommit();
|
| layer_tree_host()->SetNeedsAnimate();
|
| }
|
| }
|
|
|
| - virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
|
| + void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
|
| if (++num_draw_layers_ == 2)
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| + void AfterTest() override {
|
| // The first commit will always draw; make sure the second draw triggered
|
| // by the SetNeedsCommit was not cancelled.
|
| EXPECT_EQ(2, num_draw_layers_);
|
| @@ -848,7 +824,7 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw
|
| public:
|
| LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw() : started_times_(0) {}
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
| content_ = FakeContentLayer::Create(&client_);
|
| content_->SetBounds(gfx::Size(4, 4));
|
| @@ -856,27 +832,24 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw
|
| layer_tree_host()->root_layer()->AddChild(content_);
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| layer_tree_host()->SetViewportSize(gfx::Size());
|
| PostAddAnimationToMainThread(content_.get());
|
| }
|
|
|
| - virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| started_times_++;
|
| }
|
|
|
| - virtual void NotifyAnimationFinished(
|
| - base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationFinished(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| - EXPECT_EQ(1, started_times_);
|
| - }
|
| + void AfterTest() override { EXPECT_EQ(1, started_times_); }
|
|
|
| private:
|
| int started_times_;
|
| @@ -894,7 +867,7 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotVisible
|
| public:
|
| LayerTreeHostAnimationTestRunAnimationWhenNotVisible() : started_times_(0) {}
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
| content_ = FakeContentLayer::Create(&client_);
|
| content_->SetBounds(gfx::Size(4, 4));
|
| @@ -902,33 +875,32 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotVisible
|
| layer_tree_host()->root_layer()->AddChild(content_);
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| visible_ = true;
|
| PostAddAnimationToMainThread(content_.get());
|
| }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| visible_ = false;
|
| layer_tree_host()->SetVisible(false);
|
| }
|
|
|
| - virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| EXPECT_FALSE(visible_);
|
| started_times_++;
|
| }
|
|
|
| - virtual void NotifyAnimationFinished(
|
| - base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationFinished(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| EXPECT_FALSE(visible_);
|
| EXPECT_EQ(1, started_times_);
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| bool visible_;
|
| @@ -944,7 +916,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(
|
| // checkerboard.
|
| class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
|
| : public LayerTreeHostAnimationTest {
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
| content_ = FakeContentLayer::Create(&client_);
|
| content_->SetBounds(gfx::Size(4, 4));
|
| @@ -952,13 +924,13 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
|
| layer_tree_host()->root_layer()->AddChild(content_);
|
| }
|
|
|
| - virtual void InitializeSettings(LayerTreeSettings* settings) override {
|
| + void InitializeSettings(LayerTreeSettings* settings) override {
|
| // Make sure that drawing many times doesn't cause a checkerboarded
|
| // animation to start so we avoid flake in this test.
|
| settings->timeout_and_draw_when_animation_checkerboards = false;
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| + void BeginTest() override {
|
| prevented_draw_ = 0;
|
| added_animations_ = 0;
|
| started_times_ = 0;
|
| @@ -966,10 +938,9 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
|
| PostSetNeedsCommitToMainThread();
|
| }
|
|
|
| - virtual DrawResult PrepareToDrawOnThread(
|
| - LayerTreeHostImpl* host_impl,
|
| - LayerTreeHostImpl::FrameData* frame_data,
|
| - DrawResult draw_result) override {
|
| + DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| + LayerTreeHostImpl::FrameData* frame_data,
|
| + DrawResult draw_result) override {
|
| if (added_animations_ < 2)
|
| return draw_result;
|
| if (TestEnded())
|
| @@ -981,7 +952,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
|
| return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
|
| }
|
|
|
| - virtual void DidCommitAndDrawFrame() override {
|
| + void DidCommitAndDrawFrame() override {
|
| switch (layer_tree_host()->source_frame_number()) {
|
| case 1:
|
| // The animation is longer than 1 BeginFrame interval.
|
| @@ -996,15 +967,15 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
|
| }
|
| }
|
|
|
| - virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| - Animation::TargetProperty target_property,
|
| - int group) override {
|
| + void NotifyAnimationStarted(base::TimeTicks monotonic_time,
|
| + Animation::TargetProperty target_property,
|
| + int group) override {
|
| if (TestEnded())
|
| return;
|
| started_times_++;
|
| }
|
|
|
| - virtual void AfterTest() override {
|
| + void AfterTest() override {
|
| // Make sure we tried to draw the second animation but failed.
|
| EXPECT_LT(0, prevented_draw_);
|
| // The first animation should be started, but the second should not because
|
| @@ -1030,7 +1001,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
|
| public:
|
| LayerTreeHostAnimationTestScrollOffsetChangesArePropagated() {}
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
|
|
| scroll_layer_ = FakeContentLayer::Create(&client_);
|
| @@ -1040,11 +1011,9 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
|
| layer_tree_host()->root_layer()->AddChild(scroll_layer_);
|
| }
|
|
|
| - virtual void BeginTest() override {
|
| - PostSetNeedsCommitToMainThread();
|
| - }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| switch (layer_tree_host()->source_frame_number()) {
|
| case 1: {
|
| scoped_ptr<ScrollOffsetAnimationCurve> curve(
|
| @@ -1069,7 +1038,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
|
| }
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| FakeContentLayerClient client_;
|
| @@ -1088,9 +1057,9 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
|
| LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers()
|
| : frame_count_with_pending_tree_(0) {}
|
|
|
| - virtual void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| if (layer_tree_host()->source_frame_number() == 1) {
|
| AddAnimatedTransformToLayer(layer_tree_host()->root_layer(), 4, 1, 1);
|
| } else if (layer_tree_host()->source_frame_number() == 2) {
|
| @@ -1105,12 +1074,12 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
|
| }
|
| }
|
|
|
| - virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
|
| if (host_impl->settings().impl_side_painting)
|
| host_impl->BlockNotifyReadyToActivateForTesting(true);
|
| }
|
|
|
| - virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| + void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| // For the commit that added animations to new and existing layers, keep
|
| // blocking activation. We want to verify that even with activation blocked,
|
| // the animation on the layer that's already in the active tree won't get a
|
| @@ -1121,8 +1090,8 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
|
| }
|
| }
|
|
|
| - virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
|
| - const BeginFrameArgs& args) override {
|
| + void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
|
| + const BeginFrameArgs& args) override {
|
| if (!host_impl->pending_tree() ||
|
| host_impl->pending_tree()->source_frame_number() != 2)
|
| return;
|
| @@ -1134,8 +1103,8 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
|
| }
|
| }
|
|
|
| - virtual void UpdateAnimationState(LayerTreeHostImpl* host_impl,
|
| - bool has_unfinished_animation) override {
|
| + void UpdateAnimationState(LayerTreeHostImpl* host_impl,
|
| + bool has_unfinished_animation) override {
|
| LayerAnimationController* root_controller_impl =
|
| host_impl->active_tree()->root_layer()->layer_animation_controller();
|
| Animation* root_animation =
|
| @@ -1156,7 +1125,7 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
|
| EndTest();
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| int frame_count_with_pending_tree_;
|
| @@ -1171,16 +1140,16 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
|
| LayerTreeHostAnimationTestAddAnimationAfterAnimating()
|
| : num_swap_buffers_(0) {}
|
|
|
| - virtual void SetupTree() override {
|
| + void SetupTree() override {
|
| LayerTreeHostAnimationTest::SetupTree();
|
| content_ = Layer::Create();
|
| content_->SetBounds(gfx::Size(4, 4));
|
| layer_tree_host()->root_layer()->AddChild(content_);
|
| }
|
|
|
| - virtual void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|
| - virtual void DidCommit() override {
|
| + void DidCommit() override {
|
| switch (layer_tree_host()->source_frame_number()) {
|
| case 1:
|
| // First frame: add an animation to the root layer.
|
| @@ -1194,8 +1163,7 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
|
| }
|
| }
|
|
|
| - virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
|
| - bool result) override {
|
| + void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
|
| // After both animations have started, verify that they have valid
|
| // start times.
|
| num_swap_buffers_++;
|
| @@ -1220,7 +1188,7 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
|
| }
|
| }
|
|
|
| - virtual void AfterTest() override {}
|
| + void AfterTest() override {}
|
|
|
| private:
|
| scoped_refptr<Layer> content_;
|
|
|