| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/svg/graphics/SVGImage.h" | 5 #include "core/svg/graphics/SVGImage.h" |
| 6 | 6 |
| 7 #include "core/svg/graphics/SVGImageChromeClient.h" | 7 #include "core/svg/graphics/SVGImageChromeClient.h" |
| 8 #include "platform/SharedBuffer.h" | 8 #include "platform/SharedBuffer.h" |
| 9 #include "platform/Timer.h" | 9 #include "platform/Timer.h" |
| 10 #include "platform/geometry/FloatRect.h" | 10 #include "platform/geometry/FloatRect.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 bool runsTasksOnCurrentThread() override { return true; } | 41 bool runsTasksOnCurrentThread() override { return true; } |
| 42 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; } | 42 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; } |
| 43 double virtualTimeSeconds() const override { return 0.0; } | 43 double virtualTimeSeconds() const override { return 0.0; } |
| 44 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m
_time; } | 44 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m
_time; } |
| 45 | 45 |
| 46 double m_time; | 46 double m_time; |
| 47 Task* m_currentTask; | 47 Task* m_currentTask; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class MockTimer : public Timer<SVGImageChromeClient> { | 50 class MockTimer : public TaskRunnerTimer<SVGImageChromeClient> { |
| 51 typedef void (SVGImageChromeClient::*TimerFiredFunction)(Timer*); | |
| 52 public: | 51 public: |
| 52 using TimerFiredFunction = typename TaskRunnerTimer<SVGImageChromeClient>::T
imerFiredFunction; |
| 53 |
| 53 MockTimer(SVGImageChromeClient* o, TimerFiredFunction f) | 54 MockTimer(SVGImageChromeClient* o, TimerFiredFunction f) |
| 54 : Timer<SVGImageChromeClient>(o, f, &m_taskRunner) | 55 : TaskRunnerTimer(&m_taskRunner, o, f) |
| 55 { | 56 { |
| 56 } | 57 } |
| 57 | 58 |
| 58 void fire() | 59 void fire() |
| 59 { | 60 { |
| 60 this->Timer<SVGImageChromeClient>::fired(); | 61 fired(); |
| 61 stop(); | 62 stop(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void setTime(double newTime) | 65 void setTime(double newTime) |
| 65 { | 66 { |
| 66 m_taskRunner.setTime(newTime); | 67 m_taskRunner.setTime(newTime); |
| 67 } | 68 } |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 MockTaskRunner m_taskRunner; | 71 MockTaskRunner m_taskRunner; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 EXPECT_TRUE(chromeClient.isSuspended()); | 187 EXPECT_TRUE(chromeClient.isSuspended()); |
| 187 EXPECT_FALSE(timer->isActive()); | 188 EXPECT_FALSE(timer->isActive()); |
| 188 | 189 |
| 189 // Simulate a draw. This should resume the animation again. | 190 // Simulate a draw. This should resume the animation again. |
| 190 pumpFrame(); | 191 pumpFrame(); |
| 191 EXPECT_FALSE(chromeClient.isSuspended()); | 192 EXPECT_FALSE(chromeClient.isSuspended()); |
| 192 EXPECT_TRUE(timer->isActive()); | 193 EXPECT_TRUE(timer->isActive()); |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |