OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef APP_TEST_ANIMATION_DELEGATE_H_ | 5 #ifndef APP_TEST_ANIMATION_DELEGATE_H_ |
6 #define APP_TEST_ANIMATION_DELEGATE_H_ | 6 #define APP_TEST_ANIMATION_DELEGATE_H_ |
7 | 7 |
8 #include "app/animation.h" | 8 #include "app/animation.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 | 10 |
11 // Trivial AnimationDelegate implementation. AnimationEnded/Canceled quit the | 11 // Trivial AnimationDelegate implementation. AnimationEnded/Canceled quit the |
12 // message loop. | 12 // message loop. |
13 class TestAnimationDelegate : public AnimationDelegate { | 13 class TestAnimationDelegate : public AnimationDelegate { |
14 public: | 14 public: |
15 TestAnimationDelegate() : canceled_(false), finished_(false) { | 15 TestAnimationDelegate() : canceled_(false), finished_(false) { |
16 } | 16 } |
17 | 17 |
18 virtual void AnimationStarted(const Animation* animation) { | |
19 } | |
20 | |
21 virtual void AnimationEnded(const Animation* animation) { | 18 virtual void AnimationEnded(const Animation* animation) { |
22 finished_ = true; | 19 finished_ = true; |
23 MessageLoop::current()->Quit(); | 20 MessageLoop::current()->Quit(); |
24 } | 21 } |
25 | 22 |
26 virtual void AnimationCanceled(const Animation* animation) { | 23 virtual void AnimationCanceled(const Animation* animation) { |
27 finished_ = true; | 24 finished_ = true; |
28 canceled_ = true; | 25 canceled_ = true; |
29 MessageLoop::current()->Quit(); | 26 MessageLoop::current()->Quit(); |
30 } | 27 } |
31 | 28 |
32 bool finished() const { | 29 bool finished() const { |
33 return finished_; | 30 return finished_; |
34 } | 31 } |
35 | 32 |
36 bool canceled() const { | 33 bool canceled() const { |
37 return canceled_; | 34 return canceled_; |
38 } | 35 } |
39 | 36 |
40 private: | 37 private: |
41 bool canceled_; | 38 bool canceled_; |
42 bool finished_; | 39 bool finished_; |
43 | 40 |
44 DISALLOW_COPY_AND_ASSIGN(TestAnimationDelegate); | 41 DISALLOW_COPY_AND_ASSIGN(TestAnimationDelegate); |
45 }; | 42 }; |
46 | 43 |
47 #endif // APP_TEST_ANIMATION_DELEGATE_H_ | 44 #endif // APP_TEST_ANIMATION_DELEGATE_H_ |
OLD | NEW |