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

Side by Side Diff: ash/wm/window_animations_unittest.cc

Issue 420013002: Introduce NON_ZERO_DURATION for animation unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: content_unittests Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_selector_unittest.cc ('k') | ash/wm/workspace_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include "ash/shell_window_ids.h" 7 #include "ash/shell_window_ids.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ash/wm/workspace_controller.h" 10 #include "ash/wm/workspace_controller.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 ui::LayerAnimationSequence* sequence) OVERRIDE {} 58 ui::LayerAnimationSequence* sequence) OVERRIDE {}
59 59
60 private: 60 private:
61 ui::LayerAnimator* animator_; 61 ui::LayerAnimator* animator_;
62 base::TimeDelta duration_; 62 base::TimeDelta duration_;
63 63
64 DISALLOW_COPY_AND_ASSIGN(MinimizeAnimationObserver); 64 DISALLOW_COPY_AND_ASSIGN(MinimizeAnimationObserver);
65 }; 65 };
66 66
67 TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) { 67 TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) {
68 ui::ScopedAnimationDurationScaleMode test_duration_mode(
69 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
70
68 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); 71 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
69 window->Show(); 72 window->Show();
70 EXPECT_TRUE(window->layer()->visible()); 73 EXPECT_TRUE(window->layer()->visible());
71 74
72 // Hiding. 75 // Hiding.
73 ::wm::SetWindowVisibilityAnimationType( 76 ::wm::SetWindowVisibilityAnimationType(
74 window.get(), 77 window.get(),
75 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE); 78 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE);
76 AnimateOnChildWindowVisibilityChanged(window.get(), false); 79 AnimateOnChildWindowVisibilityChanged(window.get(), false);
77 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity()); 80 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
(...skipping 25 matching lines...) Expand all
103 EXPECT_TRUE(window->layer()->GetTargetVisibility()); 106 EXPECT_TRUE(window->layer()->GetTargetVisibility());
104 window->Hide(); 107 window->Hide();
105 EXPECT_FALSE(window->layer()->GetTargetVisibility()); 108 EXPECT_FALSE(window->layer()->GetTargetVisibility());
106 window->Show(); 109 window->Show();
107 EXPECT_TRUE(window->layer()->GetTargetVisibility()); 110 EXPECT_TRUE(window->layer()->GetTargetVisibility());
108 } 111 }
109 112
110 namespace wm { 113 namespace wm {
111 114
112 TEST_F(WindowAnimationsTest, CrossFadeToBounds) { 115 TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
113 ui::ScopedAnimationDurationScaleMode normal_duration_mode( 116 ui::ScopedAnimationDurationScaleMode test_duration_mode(
114 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); 117 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
115 118
116 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0)); 119 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0));
117 window->SetBounds(gfx::Rect(5, 10, 320, 240)); 120 window->SetBounds(gfx::Rect(5, 10, 320, 240));
118 window->Show(); 121 window->Show();
119 122
120 Layer* old_layer = window->layer(); 123 Layer* old_layer = window->layer();
121 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); 124 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
122 125
123 // Cross fade to a larger size, as in a maximize animation. 126 // Cross fade to a larger size, as in a maximize animation.
124 GetWindowState(window.get())->SetBoundsDirectCrossFade( 127 GetWindowState(window.get())->SetBoundsDirectCrossFade(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 164
162 old_layer->GetAnimator()->Step(base::TimeTicks::Now() + 165 old_layer->GetAnimator()->Step(base::TimeTicks::Now() +
163 base::TimeDelta::FromSeconds(1)); 166 base::TimeDelta::FromSeconds(1));
164 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + 167 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() +
165 base::TimeDelta::FromSeconds(1)); 168 base::TimeDelta::FromSeconds(1));
166 } 169 }
167 170
168 } // namespace wm 171 } // namespace wm
169 172
170 TEST_F(WindowAnimationsTest, LockAnimationDuration) { 173 TEST_F(WindowAnimationsTest, LockAnimationDuration) {
171 ui::ScopedAnimationDurationScaleMode normal_duration_mode( 174 ui::ScopedAnimationDurationScaleMode test_duration_mode(
172 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); 175 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
173 176
174 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0)); 177 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0));
175 Layer* layer = window->layer(); 178 Layer* layer = window->layer();
176 window->SetBounds(gfx::Rect(5, 10, 320, 240)); 179 window->SetBounds(gfx::Rect(5, 10, 320, 240));
177 window->Show(); 180 window->Show();
178 181
179 // Test that it is possible to override transition duration when it is not 182 // Test that it is possible to override transition duration when it is not
180 // locked. 183 // locked.
181 { 184 {
182 ui::ScopedLayerAnimationSettings settings1(layer->GetAnimator()); 185 ui::ScopedLayerAnimationSettings settings1(layer->GetAnimator());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 EXPECT_TRUE(layer->GetAnimator()->is_animating()); 240 EXPECT_TRUE(layer->GetAnimator()->is_animating());
238 // Expect default duration (200ms for stock ash minimizing animation). 241 // Expect default duration (200ms for stock ash minimizing animation).
239 EXPECT_EQ(default_duration.InMilliseconds(), 242 EXPECT_EQ(default_duration.InMilliseconds(),
240 layer->GetAnimator()->GetTransitionDuration().InMilliseconds()); 243 layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
241 window->Show(); 244 window->Show();
242 layer->GetAnimator()->StopAnimating(); 245 layer->GetAnimator()->StopAnimating();
243 } 246 }
244 } 247 }
245 248
246 } // namespace ash 249 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_unittest.cc ('k') | ash/wm/workspace_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698