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

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

Issue 10800020: Add brightness/grayscale animations and use them for OOBE boot transition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix hide animation Created 8 years, 5 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
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 "base/time.h" 9 #include "base/time.h"
10 #include "ui/aura/test/test_windows.h" 10 #include "ui/aura/test/test_windows.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ui::AnimationContainerElement* element = 90 ui::AnimationContainerElement* element =
91 static_cast<ui::AnimationContainerElement*>( 91 static_cast<ui::AnimationContainerElement*>(
92 window->layer()->GetAnimator()); 92 window->layer()->GetAnimator());
93 element->Step(base::TimeTicks::Now() + 93 element->Step(base::TimeTicks::Now() +
94 base::TimeDelta::FromSeconds(5)); 94 base::TimeDelta::FromSeconds(5));
95 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity()); 95 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
96 EXPECT_FALSE(window->layer()->GetTargetVisibility()); 96 EXPECT_FALSE(window->layer()->GetTargetVisibility());
97 EXPECT_FALSE(window->layer()->visible()); 97 EXPECT_FALSE(window->layer()->visible());
98 } 98 }
99 99
100 TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) {
101 aura::Window* default_container =
102 ash::Shell::GetContainer(
103 Shell::GetPrimaryRootWindow(),
104 internal::kShellWindowId_DefaultContainer);
105 scoped_ptr<aura::Window> window(
106 aura::test::CreateTestWindowWithId(0, default_container));
107 window->Show();
108 EXPECT_TRUE(window->layer()->visible());
109
110 // Hiding.
111 SetWindowVisibilityAnimationType(
112 window.get(),
113 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE);
114 ash::internal::AnimateOnChildWindowVisibilityChanged(
115 window.get(), false);
116 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
117 EXPECT_FALSE(window->layer()->GetTargetVisibility());
118 EXPECT_FALSE(window->layer()->visible());
119
120 // Showing.
121 SetWindowVisibilityAnimationType(
122 window.get(),
123 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE);
124 ash::internal::AnimateOnChildWindowVisibilityChanged(
125 window.get(), true);
126 EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness());
127 EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale());
128 EXPECT_TRUE(window->layer()->visible());
129
130 // Stays shown.
131 ui::AnimationContainerElement* element =
132 static_cast<ui::AnimationContainerElement*>(
133 window->layer()->GetAnimator());
134 element->Step(base::TimeTicks::Now() +
135 base::TimeDelta::FromSeconds(5));
136 EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness());
137 EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale());
138 EXPECT_TRUE(window->layer()->visible());
139 }
140
100 TEST_F(WindowAnimationsTest, LayerTargetVisibility) { 141 TEST_F(WindowAnimationsTest, LayerTargetVisibility) {
101 aura::Window* default_container = 142 aura::Window* default_container =
102 ash::Shell::GetContainer( 143 ash::Shell::GetContainer(
103 Shell::GetPrimaryRootWindow(), 144 Shell::GetPrimaryRootWindow(),
104 internal::kShellWindowId_DefaultContainer); 145 internal::kShellWindowId_DefaultContainer);
105 scoped_ptr<aura::Window> window( 146 scoped_ptr<aura::Window> window(
106 aura::test::CreateTestWindowWithId(0, default_container)); 147 aura::test::CreateTestWindowWithId(0, default_container));
107 148
108 // Layer target visibility changes according to Show/Hide. 149 // Layer target visibility changes according to Show/Hide.
109 window->Show(); 150 window->Show();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Medium changes take medium time. 235 // Medium changes take medium time.
195 gfx::Rect half_screen(10, 10, 500, 250); 236 gfx::Rect half_screen(10, 10, 500, 250);
196 EXPECT_EQ(kMinimum + kRange * 3 / 4, 237 EXPECT_EQ(kMinimum + kRange * 3 / 4,
197 GetCrossFadeDuration(half_screen, screen).InMilliseconds()); 238 GetCrossFadeDuration(half_screen, screen).InMilliseconds());
198 EXPECT_EQ(kMinimum + kRange * 3 / 4, 239 EXPECT_EQ(kMinimum + kRange * 3 / 4,
199 GetCrossFadeDuration(screen, half_screen).InMilliseconds()); 240 GetCrossFadeDuration(screen, half_screen).InMilliseconds());
200 } 241 }
201 242
202 } // namespace internal 243 } // namespace internal
203 } // namespace ash 244 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_animations.cc ('k') | chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698