Commit 496fdc77 authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Chromium LUCI CQ

Revert "Fix frame generation timing"

This reverts commit 72367c7a.

Reason for revert: Caused test failures: crbug.com/1154484

Original change's description:
> Fix frame generation timing
>
> Bug: 1150492
>
> Change-Id: Ifd8e735f5682ffc6f09ebcddc22f43cbcd5300ce
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2562158
> Reviewed-by: Robert Flack <flackr@chromium.org>
> Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#832534}

TBR=flackr@chromium.org,oshima@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ib7281c1c6f0230beb68dfbc596622d263d7841b5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1150492
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567020Reviewed-by: default avatarHajime Hoshi <hajimehoshi@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832594}
parent d01360ae
...@@ -27,13 +27,13 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimation) { ...@@ -27,13 +27,13 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimation) {
layer.SetOpacity(0.5f); layer.SetOpacity(0.5f);
root_layer()->Add(&layer); root_layer()->Add(&layer);
bool reported = false; base::RunLoop run_loop;
{ {
LayerAnimator* animator = layer.GetAnimator(); LayerAnimator* animator = layer.GetAnimator();
AnimationThroughputReporter reporter( AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting( animator, base::BindLambdaForTesting(
[&](const cc::FrameSequenceMetrics::CustomReportData&) { [&](const cc::FrameSequenceMetrics::CustomReportData&) {
reported = true; run_loop.Quit();
})); }));
ScopedLayerAnimationSettings settings(animator); ScopedLayerAnimationSettings settings(animator);
...@@ -42,7 +42,7 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimation) { ...@@ -42,7 +42,7 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimation) {
} }
// The animation starts in next frame (16ms) and ends 48 ms later. // The animation starts in next frame (16ms) and ends 48 ms later.
Advance(base::TimeDelta::FromMilliseconds(64)); Advance(base::TimeDelta::FromMilliseconds(64));
EXPECT_TRUE(reported); run_loop.Run();
} }
// Tests animation throughput collection with implicit animation setup before // Tests animation throughput collection with implicit animation setup before
...@@ -51,13 +51,13 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimationLateAttach) { ...@@ -51,13 +51,13 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimationLateAttach) {
Layer layer; Layer layer;
layer.SetOpacity(0.5f); layer.SetOpacity(0.5f);
bool reported = false; base::RunLoop run_loop;
{ {
LayerAnimator* animator = layer.GetAnimator(); LayerAnimator* animator = layer.GetAnimator();
AnimationThroughputReporter reporter( AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting( animator, base::BindLambdaForTesting(
[&](const cc::FrameSequenceMetrics::CustomReportData&) { [&](const cc::FrameSequenceMetrics::CustomReportData&) {
reported = true; run_loop.Quit();
})); }));
ScopedLayerAnimationSettings settings(animator); ScopedLayerAnimationSettings settings(animator);
...@@ -68,7 +68,7 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimationLateAttach) { ...@@ -68,7 +68,7 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimationLateAttach) {
// Attach to root after animation setup. // Attach to root after animation setup.
root_layer()->Add(&layer); root_layer()->Add(&layer);
Advance(base::TimeDelta::FromMilliseconds(64)); Advance(base::TimeDelta::FromMilliseconds(64));
EXPECT_TRUE(reported); run_loop.Run();
} }
// Tests animation throughput collection with explicitly created animation // Tests animation throughput collection with explicitly created animation
...@@ -78,13 +78,13 @@ TEST_F(AnimationThroughputReporterTest, ExplicitAnimation) { ...@@ -78,13 +78,13 @@ TEST_F(AnimationThroughputReporterTest, ExplicitAnimation) {
layer.SetOpacity(0.5f); layer.SetOpacity(0.5f);
root_layer()->Add(&layer); root_layer()->Add(&layer);
bool reported = false; base::RunLoop run_loop;
{ {
LayerAnimator* animator = layer.GetAnimator(); LayerAnimator* animator = layer.GetAnimator();
AnimationThroughputReporter reporter( AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting( animator, base::BindLambdaForTesting(
[&](const cc::FrameSequenceMetrics::CustomReportData&) { [&](const cc::FrameSequenceMetrics::CustomReportData&) {
reported = true; run_loop.Quit();
})); }));
animator->ScheduleAnimation( animator->ScheduleAnimation(
...@@ -92,7 +92,7 @@ TEST_F(AnimationThroughputReporterTest, ExplicitAnimation) { ...@@ -92,7 +92,7 @@ TEST_F(AnimationThroughputReporterTest, ExplicitAnimation) {
1.0f, base::TimeDelta::FromMilliseconds(48)))); 1.0f, base::TimeDelta::FromMilliseconds(48))));
} }
Advance(base::TimeDelta::FromMilliseconds(64)); Advance(base::TimeDelta::FromMilliseconds(64));
EXPECT_TRUE(reported); run_loop.Run();
} }
// Tests animation throughput collection for a persisted animator of a Layer. // Tests animation throughput collection for a persisted animator of a Layer.
...@@ -106,24 +106,24 @@ TEST_F(AnimationThroughputReporterTest, PersistedAnimation) { ...@@ -106,24 +106,24 @@ TEST_F(AnimationThroughputReporterTest, PersistedAnimation) {
new LayerAnimator(base::TimeDelta::FromMilliseconds(48)); new LayerAnimator(base::TimeDelta::FromMilliseconds(48));
layer->SetAnimator(animator); layer->SetAnimator(animator);
bool reported = false; std::unique_ptr<base::RunLoop> run_loop = std::make_unique<base::RunLoop>();
// |reporter| keeps reporting as long as it is alive. // |reporter| keeps reporting as long as it is alive.
AnimationThroughputReporter reporter( AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting( animator, base::BindLambdaForTesting(
[&](const cc::FrameSequenceMetrics::CustomReportData&) { [&](const cc::FrameSequenceMetrics::CustomReportData&) {
reported = true; run_loop->Quit();
})); }));
// Report data for animation of opacity goes to 1. // Report data for animation of opacity goes to 1.
layer->SetOpacity(1.0f); layer->SetOpacity(1.0f);
Advance(base::TimeDelta::FromMilliseconds(64)); Advance(base::TimeDelta::FromMilliseconds(64));
EXPECT_TRUE(reported); run_loop->Run();
// Report data for animation of opacity goes to 0.5. // Report data for animation of opacity goes to 0.5.
reported = false; run_loop = std::make_unique<base::RunLoop>();
layer->SetOpacity(0.5f); layer->SetOpacity(0.5f);
Advance(base::TimeDelta::FromMilliseconds(64)); Advance(base::TimeDelta::FromMilliseconds(64));
EXPECT_TRUE(reported); run_loop->Run();
} }
// Tests animation throughput not reported when animation is aborted. // Tests animation throughput not reported when animation is aborted.
...@@ -205,7 +205,6 @@ TEST_F(AnimationThroughputReporterTest, EndDetachedNoReportNoLeak) { ...@@ -205,7 +205,6 @@ TEST_F(AnimationThroughputReporterTest, EndDetachedNoReportNoLeak) {
// Wait a bit to ensure that report does not happen. // Wait a bit to ensure that report does not happen.
Advance(base::TimeDelta::FromMilliseconds(100)); Advance(base::TimeDelta::FromMilliseconds(100));
EXPECT_FALSE(animator->is_animating());
// AnimationTracker in |reporter| should not leak in asan. // AnimationTracker in |reporter| should not leak in asan.
} }
...@@ -235,12 +234,12 @@ TEST_F(AnimationThroughputReporterTest, ReportForAnimateToNewTarget) { ...@@ -235,12 +234,12 @@ TEST_F(AnimationThroughputReporterTest, ReportForAnimateToNewTarget) {
} }
// Animate to new target. Report should happen. // Animate to new target. Report should happen.
bool reported = false; base::RunLoop run_loop;
{ {
AnimationThroughputReporter reporter( AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting( animator, base::BindLambdaForTesting(
[&](const cc::FrameSequenceMetrics::CustomReportData&) { [&](const cc::FrameSequenceMetrics::CustomReportData&) {
reported = true; run_loop.Quit();
})); }));
ScopedLayerAnimationSettings settings(animator); ScopedLayerAnimationSettings settings(animator);
...@@ -251,7 +250,7 @@ TEST_F(AnimationThroughputReporterTest, ReportForAnimateToNewTarget) { ...@@ -251,7 +250,7 @@ TEST_F(AnimationThroughputReporterTest, ReportForAnimateToNewTarget) {
layer->SetBounds(gfx::Rect(0, 0, 5, 6)); layer->SetBounds(gfx::Rect(0, 0, 5, 6));
} }
Advance(base::TimeDelta::FromMilliseconds(64)); Advance(base::TimeDelta::FromMilliseconds(64));
EXPECT_TRUE(reported); run_loop.Run();
} }
} // namespace ui } // namespace ui
...@@ -22,7 +22,7 @@ AnimationThroughputReporterTestBase::~AnimationThroughputReporterTestBase() = ...@@ -22,7 +22,7 @@ AnimationThroughputReporterTestBase::~AnimationThroughputReporterTestBase() =
void AnimationThroughputReporterTestBase::SetUp() { void AnimationThroughputReporterTestBase::SetUp() {
context_factories_ = std::make_unique<TestContextFactories>(false); context_factories_ = std::make_unique<TestContextFactories>(false);
const gfx::Rect bounds(300, 300); const gfx::Rect bounds(100, 100);
host_.reset(TestCompositorHost::Create( host_.reset(TestCompositorHost::Create(
bounds, context_factories_->GetContextFactory())); bounds, context_factories_->GetContextFactory()));
host_->Show(); host_->Show();
...@@ -30,7 +30,7 @@ void AnimationThroughputReporterTestBase::SetUp() { ...@@ -30,7 +30,7 @@ void AnimationThroughputReporterTestBase::SetUp() {
compositor()->SetRootLayer(&root_); compositor()->SetRootLayer(&root_);
frame_generation_timer_.Start( frame_generation_timer_.Start(
FROM_HERE, base::TimeDelta::FromMilliseconds(16), this, FROM_HERE, base::TimeDelta::FromMilliseconds(50), this,
&AnimationThroughputReporterTestBase::GenerateOneFrame); &AnimationThroughputReporterTestBase::GenerateOneFrame);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment