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 21 matching lines...) Expand all Loading... |
32 #include "core/animation/TimedItem.h" | 32 #include "core/animation/TimedItem.h" |
33 | 33 |
34 #include <gtest/gtest.h> | 34 #include <gtest/gtest.h> |
35 | 35 |
36 using namespace WebCore; | 36 using namespace WebCore; |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 class TestTimedItemEventDelegate : public TimedItem::EventDelegate { | 40 class TestTimedItemEventDelegate : public TimedItem::EventDelegate { |
41 public: | 41 public: |
42 void onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedI
tem::Phase previousPhase, double previousIteration) OVERRIDE | 42 virtual void onEventCondition(const TimedItem* timedItem, bool isFirstSample
, TimedItem::Phase previousPhase, double previousIteration) OVERRIDE |
43 { | 43 { |
44 m_eventTriggered = true; | 44 m_eventTriggered = true; |
45 m_phaseChanged = previousPhase != timedItem->phase(); | 45 m_phaseChanged = previousPhase != timedItem->phase(); |
46 m_iterationChanged = previousIteration != timedItem->currentIteration(); | 46 m_iterationChanged = previousIteration != timedItem->currentIteration(); |
47 | 47 |
48 } | 48 } |
49 void reset() | 49 void reset() |
50 { | 50 { |
51 m_eventTriggered = false; | 51 m_eventTriggered = false; |
52 m_phaseChanged = false; | 52 m_phaseChanged = false; |
(...skipping 15 matching lines...) Expand all Loading... |
68 { | 68 { |
69 return adoptRef(new TestTimedItem(specified, new TestTimedItemEventDeleg
ate())); | 69 return adoptRef(new TestTimedItem(specified, new TestTimedItemEventDeleg
ate())); |
70 } | 70 } |
71 | 71 |
72 void updateInheritedTime(double time) | 72 void updateInheritedTime(double time) |
73 { | 73 { |
74 m_eventDelegate->reset(); | 74 m_eventDelegate->reset(); |
75 TimedItem::updateInheritedTime(time); | 75 TimedItem::updateInheritedTime(time); |
76 } | 76 } |
77 | 77 |
78 bool updateChildrenAndEffects() const OVERRIDE { return false; } | 78 virtual bool updateChildrenAndEffects() const OVERRIDE { return false; } |
79 void willDetach() { } | 79 void willDetach() { } |
80 TestTimedItemEventDelegate* eventDelegate() { return m_eventDelegate; } | 80 TestTimedItemEventDelegate* eventDelegate() { return m_eventDelegate; } |
81 double calculateTimeToEffectChange(double localTime, double timeToNextIterat
ion) const OVERRIDE | 81 virtual double calculateTimeToEffectChange(double localTime, double timeToNe
xtIteration) const OVERRIDE |
82 { | 82 { |
83 m_localTime = localTime; | 83 m_localTime = localTime; |
84 m_timeToNextIteration = timeToNextIteration; | 84 m_timeToNextIteration = timeToNextIteration; |
85 return -1; | 85 return -1; |
86 } | 86 } |
87 | 87 |
88 double takeLocalTime() | 88 double takeLocalTime() |
89 { | 89 { |
90 const double result = m_localTime; | 90 const double result = m_localTime; |
91 m_localTime = nullValue(); | 91 m_localTime = nullValue(); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 EXPECT_TRUE(std::isinf(timedItem->takeTimeToNextIteration())); | 773 EXPECT_TRUE(std::isinf(timedItem->takeTimeToNextIteration())); |
774 | 774 |
775 // Item has finished. | 775 // Item has finished. |
776 timedItem->updateInheritedTime(3.5); | 776 timedItem->updateInheritedTime(3.5); |
777 EXPECT_EQ(TimedItem::PhaseAfter, timedItem->phase()); | 777 EXPECT_EQ(TimedItem::PhaseAfter, timedItem->phase()); |
778 EXPECT_EQ(3.5, timedItem->takeLocalTime()); | 778 EXPECT_EQ(3.5, timedItem->takeLocalTime()); |
779 EXPECT_TRUE(std::isinf(timedItem->takeTimeToNextIteration())); | 779 EXPECT_TRUE(std::isinf(timedItem->takeTimeToNextIteration())); |
780 } | 780 } |
781 | 781 |
782 } | 782 } |
OLD | NEW |