Chromium Code Reviews| Index: ash/test/test_session_state_animator.cc |
| diff --git a/ash/test/test_session_state_animator.cc b/ash/test/test_session_state_animator.cc |
| index f67f431c11392e3cdcaa6b8949716c76397a24d7..9fcb10d8d3d20b2bdcb5008e0f1f4a59da43f183 100644 |
| --- a/ash/test/test_session_state_animator.cc |
| +++ b/ash/test/test_session_state_animator.cc |
| @@ -4,8 +4,10 @@ |
| #include "ash/test/test_session_state_animator.h" |
| +#include <utility> |
| #include <vector> |
| +#include "base/barrier_closure.h" |
| #include "base/bind.h" |
| namespace ash { |
| @@ -33,8 +35,9 @@ const SessionStateAnimator::Container |
| class TestSessionStateAnimator::AnimationSequence |
| : public SessionStateAnimator::AnimationSequence { |
| public: |
| - AnimationSequence(base::Closure callback, TestSessionStateAnimator* animator) |
| - : SessionStateAnimator::AnimationSequence(callback), |
| + AnimationSequence(base::OnceClosure callback, |
| + TestSessionStateAnimator* animator) |
| + : SessionStateAnimator::AnimationSequence(std::move(callback)), |
| sequence_count_(0), |
| sequence_aborted_(false), |
| animator_(animator) {} |
| @@ -210,19 +213,29 @@ void TestSessionStateAnimator::StartAnimationWithCallback( |
| int container_mask, |
| AnimationType type, |
| AnimationSpeed speed, |
| - base::Closure callback) { |
| + base::OnceClosure callback) { |
| ++last_animation_epoch_; |
| + |
| + int count = 0; |
|
James Cook
2017/05/09 18:30:40
nit: |container_count| or similar
tzik
2017/05/11 08:15:21
Done.
|
| for (size_t i = 0; i < arraysize(kAllContainers); ++i) |
|
James Cook
2017/05/09 18:30:40
nit: {}
tzik
2017/05/11 08:15:21
Done.
|
| + if (container_mask & kAllContainers[i]) |
| + ++count; |
| + |
| + base::RepeatingClosure completion_callback = |
| + base::BarrierClosure(count, std::move(callback)); |
| + for (size_t i = 0; i < arraysize(kAllContainers); ++i) { |
| if (container_mask & kAllContainers[i]) { |
| // ash::SessionStateAnimatorImpl invokes the callback whether or not the |
| // animation was completed successfully or not. |
| - AddAnimation(kAllContainers[i], type, speed, callback, callback); |
| + AddAnimation(kAllContainers[i], type, speed, completion_callback, |
| + completion_callback); |
| } |
| + } |
| } |
| ash::SessionStateAnimator::AnimationSequence* |
| -TestSessionStateAnimator::BeginAnimationSequence(base::Closure callback) { |
| - return new AnimationSequence(callback, this); |
| +TestSessionStateAnimator::BeginAnimationSequence(base::OnceClosure callback) { |
| + return new AnimationSequence(std::move(callback), this); |
| } |
| bool TestSessionStateAnimator::IsWallpaperHidden() const { |