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" |
11 #include "platform/graphics/paint/PaintCanvas.h" | 11 #include "platform/graphics/paint/PaintCanvas.h" |
12 #include "platform/graphics/paint/PaintFlags.h" | 12 #include "platform/graphics/paint/PaintFlags.h" |
13 #include "platform/testing/UnitTestHelpers.h" | 13 #include "platform/testing/UnitTestHelpers.h" |
| 14 #include "platform/wtf/PtrUtil.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
16 #include "third_party/skia/include/utils/SkNullCanvas.h" | 17 #include "third_party/skia/include/utils/SkNullCanvas.h" |
17 #include "wtf/PtrUtil.h" | |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 class SVGImageTest : public ::testing::Test { | 20 class SVGImageTest : public ::testing::Test { |
21 public: | 21 public: |
22 SVGImage& GetImage() { return *image_; } | 22 SVGImage& GetImage() { return *image_; } |
23 | 23 |
24 void Load(const char* data, bool should_pause) { | 24 void Load(const char* data, bool should_pause) { |
25 observer_ = new PauseControlImageObserver(should_pause); | 25 observer_ = new PauseControlImageObserver(should_pause); |
26 image_ = SVGImage::Create(observer_); | 26 image_ = SVGImage::Create(observer_); |
27 image_->SetData(SharedBuffer::Create(data, strlen(data)), true); | 27 image_->SetData(SharedBuffer::Create(data, strlen(data)), true); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 EXPECT_TRUE(chrome_client.IsSuspended()); | 137 EXPECT_TRUE(chrome_client.IsSuspended()); |
138 EXPECT_FALSE(timer->IsActive()); | 138 EXPECT_FALSE(timer->IsActive()); |
139 | 139 |
140 // Simulate a draw. This should resume the animation again. | 140 // Simulate a draw. This should resume the animation again. |
141 PumpFrame(); | 141 PumpFrame(); |
142 EXPECT_FALSE(chrome_client.IsSuspended()); | 142 EXPECT_FALSE(chrome_client.IsSuspended()); |
143 EXPECT_TRUE(timer->IsActive()); | 143 EXPECT_TRUE(timer->IsActive()); |
144 } | 144 } |
145 | 145 |
146 } // namespace blink | 146 } // namespace blink |
OLD | NEW |