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

Side by Side Diff: ash/test/test_session_state_animator.cc

Issue 2290473004: Rename ash desktop_background to wallpaper. (Closed)
Patch Set: Address comments. Created 4 years, 3 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
« no previous file with comments | « ash/test/test_session_state_animator.h ('k') | ash/test/test_wallpaper_delegate.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/test_session_state_animator.h" 5 #include "ash/test/test_session_state_animator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 10
11 namespace ash { 11 namespace ash {
12 namespace test { 12 namespace test {
13 13
14 namespace { 14 namespace {
15 // A no-op callback that can be used when managing an animation that didn't 15 // A no-op callback that can be used when managing an animation that didn't
16 // actually have a callback given. 16 // actually have a callback given.
17 void DummyCallback() {} 17 void DummyCallback() {}
18 } 18 }
19 19
20 const SessionStateAnimator::Container 20 const SessionStateAnimator::Container
21 TestSessionStateAnimator::kAllContainers[] = { 21 TestSessionStateAnimator::kAllContainers[] = {
22 SessionStateAnimator::DESKTOP_BACKGROUND, 22 SessionStateAnimator::WALLPAPER,
23 SessionStateAnimator::LAUNCHER, 23 SessionStateAnimator::LAUNCHER,
24 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 24 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
25 SessionStateAnimator::LOCK_SCREEN_BACKGROUND, 25 SessionStateAnimator::LOCK_SCREEN_WALLPAPER,
26 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 26 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
27 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS, 27 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS,
28 SessionStateAnimator::ROOT_CONTAINER}; 28 SessionStateAnimator::ROOT_CONTAINER};
29 29
30 // A simple SessionStateAnimator::AnimationSequence that tracks the number of 30 // A simple SessionStateAnimator::AnimationSequence that tracks the number of
31 // attached sequences. The callback will be invoked if all animations complete 31 // attached sequences. The callback will be invoked if all animations complete
32 // successfully. 32 // successfully.
33 class TestSessionStateAnimator::AnimationSequence 33 class TestSessionStateAnimator::AnimationSequence
34 : public SessionStateAnimator::AnimationSequence { 34 : public SessionStateAnimator::AnimationSequence {
35 public: 35 public:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 speed(speed), 91 speed(speed),
92 success_callback(success_callback), 92 success_callback(success_callback),
93 failed_callback(failed_callback) {} 93 failed_callback(failed_callback) {}
94 94
95 TestSessionStateAnimator::ActiveAnimation::ActiveAnimation( 95 TestSessionStateAnimator::ActiveAnimation::ActiveAnimation(
96 const ActiveAnimation& other) = default; 96 const ActiveAnimation& other) = default;
97 97
98 TestSessionStateAnimator::ActiveAnimation::~ActiveAnimation() {} 98 TestSessionStateAnimator::ActiveAnimation::~ActiveAnimation() {}
99 99
100 TestSessionStateAnimator::TestSessionStateAnimator() 100 TestSessionStateAnimator::TestSessionStateAnimator()
101 : last_animation_epoch_(0), is_background_hidden_(false) {} 101 : last_animation_epoch_(0), is_wallpaper_hidden_(false) {}
102 102
103 TestSessionStateAnimator::~TestSessionStateAnimator() { 103 TestSessionStateAnimator::~TestSessionStateAnimator() {
104 CompleteAllAnimations(false); 104 CompleteAllAnimations(false);
105 } 105 }
106 106
107 void TestSessionStateAnimator::ResetAnimationEpoch() { 107 void TestSessionStateAnimator::ResetAnimationEpoch() {
108 CompleteAllAnimations(false); 108 CompleteAllAnimations(false);
109 last_animation_epoch_ = 0; 109 last_animation_epoch_ = 0;
110 } 110 }
111 111
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // animation was completed successfully or not. 218 // animation was completed successfully or not.
219 AddAnimation(kAllContainers[i], type, speed, callback, callback); 219 AddAnimation(kAllContainers[i], type, speed, callback, callback);
220 } 220 }
221 } 221 }
222 222
223 ash::SessionStateAnimator::AnimationSequence* 223 ash::SessionStateAnimator::AnimationSequence*
224 TestSessionStateAnimator::BeginAnimationSequence(base::Closure callback) { 224 TestSessionStateAnimator::BeginAnimationSequence(base::Closure callback) {
225 return new AnimationSequence(callback, this); 225 return new AnimationSequence(callback, this);
226 } 226 }
227 227
228 bool TestSessionStateAnimator::IsBackgroundHidden() const { 228 bool TestSessionStateAnimator::IsWallpaperHidden() const {
229 return is_background_hidden_; 229 return is_wallpaper_hidden_;
230 } 230 }
231 231
232 void TestSessionStateAnimator::ShowBackground() { 232 void TestSessionStateAnimator::ShowWallpaper() {
233 is_background_hidden_ = false; 233 is_wallpaper_hidden_ = false;
234 } 234 }
235 235
236 void TestSessionStateAnimator::HideBackground() { 236 void TestSessionStateAnimator::HideWallpaper() {
237 is_background_hidden_ = true; 237 is_wallpaper_hidden_ = true;
238 } 238 }
239 239
240 void TestSessionStateAnimator::StartAnimationInSequence( 240 void TestSessionStateAnimator::StartAnimationInSequence(
241 int container_mask, 241 int container_mask,
242 AnimationType type, 242 AnimationType type,
243 AnimationSpeed speed, 243 AnimationSpeed speed,
244 AnimationSequence* animation_sequence) { 244 AnimationSequence* animation_sequence) {
245 ++last_animation_epoch_; 245 ++last_animation_epoch_;
246 for (size_t i = 0; i < arraysize(kAllContainers); ++i) { 246 for (size_t i = 0; i < arraysize(kAllContainers); ++i) {
247 if (container_mask & kAllContainers[i]) { 247 if (container_mask & kAllContainers[i]) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 while (animation_iter != (*container_iter).second.end()) { 283 while (animation_iter != (*container_iter).second.end()) {
284 ActiveAnimation active_animation = *animation_iter; 284 ActiveAnimation active_animation = *animation_iter;
285 active_animation.failed_callback.Run(); 285 active_animation.failed_callback.Run();
286 animation_iter = (*container_iter).second.erase(animation_iter); 286 animation_iter = (*container_iter).second.erase(animation_iter);
287 } 287 }
288 } 288 }
289 } 289 }
290 290
291 } // namespace test 291 } // namespace test
292 } // namespace ash 292 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/test_session_state_animator.h ('k') | ash/test/test_wallpaper_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698