Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: ash/wm/window_animations_unittest.cc

Issue 105673008: Remove unneeded ScopedLayerAnimationSettings::LockTransitionDuration() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/window_animations.cc ('k') | chrome/browser/chromeos/login/login_display_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_animations_unittest.cc
diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc
index eeeb120b0945fea3de0f2def7d3694569b01d485..efc9a5d3950928a3b2280be4ba1e549c8322cc1d 100644
--- a/ash/wm/window_animations_unittest.cc
+++ b/ash/wm/window_animations_unittest.cc
@@ -36,37 +36,6 @@ class WindowAnimationsTest : public ash::test::AshTestBase {
DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest);
};
-// Listens to animation scheduled notifications. Remembers the transition
-// duration of the first sequence.
-class MinimizeAnimationObserver : public ui::LayerAnimationObserver {
- public:
- explicit MinimizeAnimationObserver(ui::LayerAnimator* animator)
- : animator_(animator) {
- animator_->AddObserver(this);
- // RemoveObserver is called when the first animation is scheduled and so
- // there should be no need for now to remove it in destructor.
- };
- base::TimeDelta duration() { return duration_; }
-
- protected:
- // ui::LayerAnimationObserver:
- virtual void OnLayerAnimationScheduled(
- ui::LayerAnimationSequence* sequence) OVERRIDE {
- duration_ = animator_->GetTransitionDuration();
- animator_->RemoveObserver(this);
- }
- virtual void OnLayerAnimationEnded(
- ui::LayerAnimationSequence* sequence) OVERRIDE {}
- virtual void OnLayerAnimationAborted(
- ui::LayerAnimationSequence* sequence) OVERRIDE {}
-
- private:
- ui::LayerAnimator* animator_;
- base::TimeDelta duration_;
-
- DISALLOW_COPY_AND_ASSIGN(MinimizeAnimationObserver);
-};
-
TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) {
scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
window->Show();
@@ -167,77 +136,5 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
}
-TEST_F(WindowAnimationsTest, LockAnimationDuration) {
- ui::ScopedAnimationDurationScaleMode normal_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
-
- scoped_ptr<Window> window(CreateTestWindowInShellWithId(0));
- Layer* layer = window->layer();
- window->SetBounds(gfx::Rect(5, 10, 320, 240));
- window->Show();
-
- // Test that it is possible to override transition duration when it is not
- // locked.
- {
- ui::ScopedLayerAnimationSettings settings1(layer->GetAnimator());
- settings1.SetTransitionDuration(base::TimeDelta::FromMilliseconds(1000));
- {
- ui::ScopedLayerAnimationSettings settings2(layer->GetAnimator());
- // Duration is not locked so it gets overridden.
- settings2.SetTransitionDuration(base::TimeDelta::FromMilliseconds(50));
- wm::GetWindowState(window.get())->Minimize();
- EXPECT_TRUE(layer->GetAnimator()->is_animating());
- // Expect duration from the inner scope
- EXPECT_EQ(50,
- layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
- }
- window->Show();
- layer->GetAnimator()->StopAnimating();
- }
-
- // Test that it is possible to lock transition duration
- {
- ui::ScopedLayerAnimationSettings settings1(layer->GetAnimator());
- settings1.SetTransitionDuration(base::TimeDelta::FromMilliseconds(1000));
- // Duration is locked in outer scope.
- settings1.LockTransitionDuration();
- {
- ui::ScopedLayerAnimationSettings settings2(layer->GetAnimator());
- // Transition duration setting is ignored.
- settings2.SetTransitionDuration(base::TimeDelta::FromMilliseconds(50));
- wm::GetWindowState(window.get())->Minimize();
- EXPECT_TRUE(layer->GetAnimator()->is_animating());
- // Expect duration from the outer scope
- EXPECT_EQ(1000,
- layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
- }
- window->Show();
- layer->GetAnimator()->StopAnimating();
- }
-
- // Test that duration respects default.
- {
- // Query default duration.
- MinimizeAnimationObserver observer(layer->GetAnimator());
- wm::GetWindowState(window.get())->Minimize();
- EXPECT_TRUE(layer->GetAnimator()->is_animating());
- base::TimeDelta default_duration(observer.duration());
- window->Show();
- layer->GetAnimator()->StopAnimating();
-
- ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
- settings.LockTransitionDuration();
- // Setting transition duration is ignored since duration is locked
- settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(1000));
- wm::GetWindowState(window.get())->Minimize();
- EXPECT_TRUE(layer->GetAnimator()->is_animating());
- // Expect default duration (200ms for stock ash minimizing animation).
- EXPECT_EQ(default_duration.InMilliseconds(),
- layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
- window->Show();
- layer->GetAnimator()->StopAnimating();
- }
-}
-
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/wm/window_animations.cc ('k') | chrome/browser/chromeos/login/login_display_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698