| 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(bool isFirstSample, TimedItem::Phase previousPhase, Ti
medItem::Phase phase, double previousIteration, double currentIteration) OVERRID
E | 42 void onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedI
tem::Phase previousPhase, double previousIteration) OVERRIDE |
| 43 { | 43 { |
| 44 m_eventTriggered = true; | 44 m_eventTriggered = true; |
| 45 m_phaseChanged = previousPhase != phase; | 45 m_phaseChanged = previousPhase != timedItem->phase(); |
| 46 m_iterationChanged = previousIteration != 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; |
| 53 m_iterationChanged = false; | 53 m_iterationChanged = false; |
| 54 } | 54 } |
| 55 bool eventTriggered() { return m_eventTriggered; } | 55 bool eventTriggered() { return m_eventTriggered; } |
| 56 bool phaseChanged() { return m_phaseChanged; } | 56 bool phaseChanged() { return m_phaseChanged; } |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 // After end | 567 // After end |
| 568 timedItem->updateInheritedTime(3.5); | 568 timedItem->updateInheritedTime(3.5); |
| 569 ASSERT_TRUE(timedItem->eventDelegate()->eventTriggered()); | 569 ASSERT_TRUE(timedItem->eventDelegate()->eventTriggered()); |
| 570 EXPECT_TRUE(timedItem->eventDelegate()->phaseChanged()); | 570 EXPECT_TRUE(timedItem->eventDelegate()->phaseChanged()); |
| 571 EXPECT_FALSE(timedItem->eventDelegate()->iterationChanged()); | 571 EXPECT_FALSE(timedItem->eventDelegate()->iterationChanged()); |
| 572 | 572 |
| 573 timedItem->updateInheritedTime(3.6); | 573 timedItem->updateInheritedTime(3.6); |
| 574 ASSERT_FALSE(timedItem->eventDelegate()->eventTriggered()); | 574 ASSERT_FALSE(timedItem->eventDelegate()->eventTriggered()); |
| 575 } | 575 } |
| 576 } | 576 } |
| OLD | NEW |