| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/animation/AnimationClock.h" | 32 #include "core/animation/AnimationClock.h" |
| 33 | 33 |
| 34 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
| 35 #include <gtest/gtest.h> | 35 #include <gtest/gtest.h> |
| 36 | 36 |
| 37 using namespace WebCore; | 37 using namespace WebCore; |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 class CoreAnimationAnimationClockTest : public ::testing::Test { | 41 class AnimationAnimationClockTest : public ::testing::Test { |
| 42 protected: | 42 protected: |
| 43 virtual void SetUp() | 43 virtual void SetUp() |
| 44 { | 44 { |
| 45 animationClock = AnimationClock::create(mockTimeFunction); | 45 animationClock = AnimationClock::create(mockTimeFunction); |
| 46 mockTime = 200; | 46 mockTime = 200; |
| 47 } | 47 } |
| 48 | 48 |
| 49 static double mockTimeFunction() | 49 static double mockTimeFunction() |
| 50 { | 50 { |
| 51 return mockTime++; | 51 return mockTime++; |
| 52 } | 52 } |
| 53 | 53 |
| 54 static double mockTime; | 54 static double mockTime; |
| 55 OwnPtr<AnimationClock> animationClock; | 55 OwnPtr<AnimationClock> animationClock; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 double CoreAnimationAnimationClockTest::mockTime; | 58 double AnimationAnimationClockTest::mockTime; |
| 59 | 59 |
| 60 TEST_F(CoreAnimationAnimationClockTest, CurrentTime) | 60 TEST_F(AnimationAnimationClockTest, CurrentTime) |
| 61 { | 61 { |
| 62 EXPECT_EQ(200, animationClock->currentTime()); | 62 EXPECT_EQ(200, animationClock->currentTime()); |
| 63 EXPECT_EQ(200, animationClock->currentTime()); | 63 EXPECT_EQ(200, animationClock->currentTime()); |
| 64 animationClock->unfreeze(); | 64 animationClock->unfreeze(); |
| 65 EXPECT_EQ(201, animationClock->currentTime()); | 65 EXPECT_EQ(201, animationClock->currentTime()); |
| 66 EXPECT_EQ(201, animationClock->currentTime()); | 66 EXPECT_EQ(201, animationClock->currentTime()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(CoreAnimationAnimationClockTest, UpdateTime) | 69 TEST_F(AnimationAnimationClockTest, UpdateTime) |
| 70 { | 70 { |
| 71 animationClock->updateTime(100); | 71 animationClock->updateTime(100); |
| 72 EXPECT_EQ(100, animationClock->currentTime()); | 72 EXPECT_EQ(100, animationClock->currentTime()); |
| 73 EXPECT_EQ(100, animationClock->currentTime()); | 73 EXPECT_EQ(100, animationClock->currentTime()); |
| 74 animationClock->updateTime(150); | 74 animationClock->updateTime(150); |
| 75 EXPECT_EQ(150, animationClock->currentTime()); | 75 EXPECT_EQ(150, animationClock->currentTime()); |
| 76 EXPECT_EQ(150, animationClock->currentTime()); | 76 EXPECT_EQ(150, animationClock->currentTime()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } | 79 } |
| OLD | NEW |