diff options
author | vollick@google.com <vollick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-01 20:19:47 +0000 |
---|---|---|
committer | vollick@google.com <vollick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-01 20:19:47 +0000 |
commit | c15d15684de184481066b875ca7bbc9829069274 (patch) | |
tree | c52fdc9cf9bfd6083cda8e284bdde1936b1a2585 /ui/aura | |
parent | 6714272cdb8fedfc02ec66483a0a2b8fbdab3cf6 (diff) | |
download | chromium_src-c15d15684de184481066b875ca7bbc9829069274.zip chromium_src-c15d15684de184481066b875ca7bbc9829069274.tar.gz chromium_src-c15d15684de184481066b875ca7bbc9829069274.tar.bz2 |
Reland 120074 -- Disable animations during aura tests.
This causes all animations scheduled during a test to complete immediately.
After making this change, I noticed some code assumed that animations would not complete synchronously. Some of this code used animation observers, and I while fixing the code I have updated it to use the preferred ImplicitAnimationObserver.
BUG=None
TEST=aura_shell_unittests,aura_unittests,compositor_unittests
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=120074
Review URL: https://chromiumcodereview.appspot.com/9222018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/root_window.cc | 6 | ||||
-rw-r--r-- | ui/aura/root_window.h | 6 | ||||
-rw-r--r-- | ui/aura/test/aura_test_base.cc | 4 | ||||
-rw-r--r-- | ui/aura/window_unittest.cc | 5 |
4 files changed, 14 insertions, 7 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index b2f380e..0b4baa3 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -676,16 +676,16 @@ internal::FocusManager* RootWindow::GetFocusManager() { } void RootWindow::OnLayerAnimationEnded( - const ui::LayerAnimationSequence* animation) { + ui::LayerAnimationSequence* animation) { OnHostResized(host_->GetSize()); } void RootWindow::OnLayerAnimationScheduled( - const ui::LayerAnimationSequence* animation) { + ui::LayerAnimationSequence* animation) { } void RootWindow::OnLayerAnimationAborted( - const ui::LayerAnimationSequence* animation) { + ui::LayerAnimationSequence* animation) { } void RootWindow::SetFocusedWindow(Window* focused_window) { diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h index ec0f09f..4f5bd4f 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -219,11 +219,11 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, // Overridden from ui::LayerAnimationObserver: virtual void OnLayerAnimationEnded( - const ui::LayerAnimationSequence* animation) OVERRIDE; + ui::LayerAnimationSequence* animation) OVERRIDE; virtual void OnLayerAnimationScheduled( - const ui::LayerAnimationSequence* animation) OVERRIDE; + ui::LayerAnimationSequence* animation) OVERRIDE; virtual void OnLayerAnimationAborted( - const ui::LayerAnimationSequence* animation) OVERRIDE; + ui::LayerAnimationSequence* animation) OVERRIDE; // Overridden from FocusManager: virtual void SetFocusedWindow(Window* window) OVERRIDE; diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc index 70d33f5..3e1e95f 100644 --- a/ui/aura/test/aura_test_base.cc +++ b/ui/aura/test/aura_test_base.cc @@ -9,6 +9,7 @@ #endif #include "ui/aura/root_window.h" +#include "ui/gfx/compositor/layer_animator.h" namespace aura { namespace test { @@ -22,6 +23,9 @@ AuraTestBase::AuraTestBase() RootWindow::GetInstance()->Show(); RootWindow::GetInstance()->SetHostSize(gfx::Size(600, 600)); + + // Disable animations during tests. + ui::LayerAnimator::set_disable_animations_for_test(true); } AuraTestBase::~AuraTestBase() { diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 1e59c2d..78b9142 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -933,6 +933,9 @@ TEST_F(WindowTest, Property) { } TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { + // We cannot short-circuit animations in this test. + ui::LayerAnimator::set_disable_animations_for_test(false); + scoped_ptr<Window> w1( CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), NULL)); @@ -966,7 +969,7 @@ TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { // Confirm that the target bounds are reached. base::TimeTicks start_time = - w1->layer()->GetAnimator()->get_last_step_time_for_test(); + w1->layer()->GetAnimator()->last_step_time(); element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |