| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "chrome/common/animation.h" | 7 #include "chrome/common/animation.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using namespace std; | 10 using namespace std; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 bool finished() { | 73 bool finished() { |
| 74 return finished_; | 74 return finished_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool canceled() { | 77 bool canceled() { |
| 78 return canceled_; | 78 return canceled_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 bool canceled_; |
| 82 bool finished_; | 83 bool finished_; |
| 83 bool canceled_; | |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 TEST_F(AnimationTest, RunCase) { | 86 TEST_F(AnimationTest, RunCase) { |
| 87 TestAnimationDelegate ad; | 87 TestAnimationDelegate ad; |
| 88 RunAnimation a1(150, &ad); | 88 RunAnimation a1(150, &ad); |
| 89 a1.SetDuration(2000); | 89 a1.SetDuration(2000); |
| 90 a1.Start(); | 90 a1.Start(); |
| 91 MessageLoop::current()->Run(); | 91 MessageLoop::current()->Run(); |
| 92 | 92 |
| 93 EXPECT_TRUE(ad.finished()); | 93 EXPECT_TRUE(ad.finished()); |
| 94 EXPECT_FALSE(ad.canceled()); | 94 EXPECT_FALSE(ad.canceled()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 TEST_F(AnimationTest, CancelCase) { | 97 TEST_F(AnimationTest, CancelCase) { |
| 98 TestAnimationDelegate ad; | 98 TestAnimationDelegate ad; |
| 99 CancelAnimation a2(2000, 150, &ad); | 99 CancelAnimation a2(2000, 150, &ad); |
| 100 a2.Start(); | 100 a2.Start(); |
| 101 MessageLoop::current()->Run(); | 101 MessageLoop::current()->Run(); |
| 102 | 102 |
| 103 EXPECT_TRUE(ad.finished()); | 103 EXPECT_TRUE(ad.finished()); |
| 104 EXPECT_TRUE(ad.canceled()); | 104 EXPECT_TRUE(ad.canceled()); |
| 105 } | 105 } |
| 106 | 106 |
| OLD | NEW |