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

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

Issue 413403011: Revert of Introduce NON_ZERO_DURATION for animation unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
71 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); 68 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
72 window->Show(); 69 window->Show();
73 EXPECT_TRUE(window->layer()->visible()); 70 EXPECT_TRUE(window->layer()->visible());
74 71
75 // Hiding. 72 // Hiding.
76 ::wm::SetWindowVisibilityAnimationType( 73 ::wm::SetWindowVisibilityAnimationType(
77 window.get(), 74 window.get(),
78 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE); 75 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE);
79 AnimateOnChildWindowVisibilityChanged(window.get(), false); 76 AnimateOnChildWindowVisibilityChanged(window.get(), false);
80 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity()); 77 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
(...skipping 25 matching lines...) Expand all
106 EXPECT_TRUE(window->layer()->GetTargetVisibility()); 103 EXPECT_TRUE(window->layer()->GetTargetVisibility());
107 window->Hide(); 104 window->Hide();
108 EXPECT_FALSE(window->layer()->GetTargetVisibility()); 105 EXPECT_FALSE(window->layer()->GetTargetVisibility());
109 window->Show(); 106 window->Show();
110 EXPECT_TRUE(window->layer()->GetTargetVisibility()); 107 EXPECT_TRUE(window->layer()->GetTargetVisibility());
111 } 108 }
112 109
113 namespace wm { 110 namespace wm {
114 111
115 TEST_F(WindowAnimationsTest, CrossFadeToBounds) { 112 TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
116 ui::ScopedAnimationDurationScaleMode test_duration_mode( 113 ui::ScopedAnimationDurationScaleMode normal_duration_mode(
117 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); 114 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
118 115
119 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0)); 116 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0));
120 window->SetBounds(gfx::Rect(5, 10, 320, 240)); 117 window->SetBounds(gfx::Rect(5, 10, 320, 240));
121 window->Show(); 118 window->Show();
122 119
123 Layer* old_layer = window->layer(); 120 Layer* old_layer = window->layer();
124 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); 121 EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
125 122
126 // Cross fade to a larger size, as in a maximize animation. 123 // Cross fade to a larger size, as in a maximize animation.
127 GetWindowState(window.get())->SetBoundsDirectCrossFade( 124 GetWindowState(window.get())->SetBoundsDirectCrossFade(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 161
165 old_layer->GetAnimator()->Step(base::TimeTicks::Now() + 162 old_layer->GetAnimator()->Step(base::TimeTicks::Now() +
166 base::TimeDelta::FromSeconds(1)); 163 base::TimeDelta::FromSeconds(1));
167 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + 164 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() +
168 base::TimeDelta::FromSeconds(1)); 165 base::TimeDelta::FromSeconds(1));
169 } 166 }
170 167
171 } // namespace wm 168 } // namespace wm
172 169
173 TEST_F(WindowAnimationsTest, LockAnimationDuration) { 170 TEST_F(WindowAnimationsTest, LockAnimationDuration) {
174 ui::ScopedAnimationDurationScaleMode test_duration_mode( 171 ui::ScopedAnimationDurationScaleMode normal_duration_mode(
175 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); 172 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
176 173
177 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0)); 174 scoped_ptr<Window> window(CreateTestWindowInShellWithId(0));
178 Layer* layer = window->layer(); 175 Layer* layer = window->layer();
179 window->SetBounds(gfx::Rect(5, 10, 320, 240)); 176 window->SetBounds(gfx::Rect(5, 10, 320, 240));
180 window->Show(); 177 window->Show();
181 178
182 // Test that it is possible to override transition duration when it is not 179 // Test that it is possible to override transition duration when it is not
183 // locked. 180 // locked.
184 { 181 {
185 ui::ScopedLayerAnimationSettings settings1(layer->GetAnimator()); 182 ui::ScopedLayerAnimationSettings settings1(layer->GetAnimator());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXPECT_TRUE(layer->GetAnimator()->is_animating()); 237 EXPECT_TRUE(layer->GetAnimator()->is_animating());
241 // Expect default duration (200ms for stock ash minimizing animation). 238 // Expect default duration (200ms for stock ash minimizing animation).
242 EXPECT_EQ(default_duration.InMilliseconds(), 239 EXPECT_EQ(default_duration.InMilliseconds(),
243 layer->GetAnimator()->GetTransitionDuration().InMilliseconds()); 240 layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
244 window->Show(); 241 window->Show();
245 layer->GetAnimator()->StopAnimating(); 242 layer->GetAnimator()->StopAnimating();
246 } 243 }
247 } 244 }
248 245
249 } // namespace ash 246 } // 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