Commit d62d5106 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Quit the loop immediately upon animation complete

The task posed in the complete callback can be executed
under load if it waits for idle. Explicitly exit upon
animation complete instead.

Bug: None
Test: Test no longer fails under load
Change-Id: Ibef010506fd7a888615b7d2d304d0a04c826d00d
Reviewed-on: https://chromium-review.googlesource.com/c/1357668Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612956}
parent 59582aea
......@@ -55,6 +55,8 @@ class TestShellObserver : public ShellObserver {
EXPECT_EQ(UNKNOWN, starting_animation_state_);
starting_animation_state_ = canceled ? CANCELED : COMPLETED;
if (run_loop_)
run_loop_->Quit();
}
void OnOverviewModeEndingAnimationComplete(bool canceled) override {
if (!should_monitor_animation_state_)
......@@ -62,6 +64,8 @@ class TestShellObserver : public ShellObserver {
EXPECT_EQ(UNKNOWN, ending_animation_state_);
ending_animation_state_ = canceled ? CANCELED : COMPLETED;
if (run_loop_)
run_loop_->Quit();
}
void Reset() {
......@@ -70,13 +74,17 @@ class TestShellObserver : public ShellObserver {
}
void WaitForStartingAnimationComplete() {
while (starting_animation_state_ != COMPLETED)
base::RunLoop().RunUntilIdle();
while (starting_animation_state_ != COMPLETED) {
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->RunUntilIdle();
}
}
void WaitForEndingAnimationComplete() {
while (ending_animation_state_ != COMPLETED)
base::RunLoop().RunUntilIdle();
while (ending_animation_state_ != COMPLETED) {
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->RunUntilIdle();
}
}
bool is_ended() const { return ending_animation_state_ != UNKNOWN; }
......@@ -106,6 +114,8 @@ class TestShellObserver : public ShellObserver {
// AnimationComplete.
bool should_monitor_animation_state_;
std::unique_ptr<base::RunLoop> run_loop_;
DISALLOW_COPY_AND_ASSIGN(TestShellObserver);
};
......
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