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/frame/FrameView.h" |
| 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/paint/PaintLayer.h" |
7 #include "core/svg/graphics/SVGImageChromeClient.h" | 10 #include "core/svg/graphics/SVGImageChromeClient.h" |
8 #include "platform/SharedBuffer.h" | 11 #include "platform/SharedBuffer.h" |
9 #include "platform/Timer.h" | 12 #include "platform/Timer.h" |
10 #include "platform/geometry/FloatRect.h" | 13 #include "platform/geometry/FloatRect.h" |
11 #include "platform/graphics/paint/PaintCanvas.h" | 14 #include "platform/graphics/paint/PaintCanvas.h" |
12 #include "platform/graphics/paint/PaintFlags.h" | 15 #include "platform/graphics/paint/PaintFlags.h" |
13 #include "platform/testing/UnitTestHelpers.h" | 16 #include "platform/testing/UnitTestHelpers.h" |
14 #include "platform/wtf/PtrUtil.h" | 17 #include "platform/wtf/PtrUtil.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 testing::RunDelayedTasks(1.0 + timer->NextFireInterval() * 1000.0); | 141 testing::RunDelayedTasks(1.0 + timer->NextFireInterval() * 1000.0); |
139 EXPECT_TRUE(chrome_client.IsSuspended()); | 142 EXPECT_TRUE(chrome_client.IsSuspended()); |
140 EXPECT_FALSE(timer->IsActive()); | 143 EXPECT_FALSE(timer->IsActive()); |
141 | 144 |
142 // Simulate a draw. This should resume the animation again. | 145 // Simulate a draw. This should resume the animation again. |
143 PumpFrame(); | 146 PumpFrame(); |
144 EXPECT_FALSE(chrome_client.IsSuspended()); | 147 EXPECT_FALSE(chrome_client.IsSuspended()); |
145 EXPECT_TRUE(timer->IsActive()); | 148 EXPECT_TRUE(timer->IsActive()); |
146 } | 149 } |
147 | 150 |
| 151 TEST_F(SVGImageTest, SupportsSubsequenceCaching) { |
| 152 const bool kShouldPause = true; |
| 153 Load(kAnimatedDocument, kShouldPause); |
| 154 PumpFrame(); |
| 155 LocalFrame* local_frame = |
| 156 ToLocalFrame(GetImage().GetPageForTesting()->MainFrame()); |
| 157 EXPECT_TRUE(local_frame->GetDocument()->IsSVGDocument()); |
| 158 LayoutObject* svg_root = local_frame->View()->GetLayoutView()->FirstChild(); |
| 159 EXPECT_TRUE(svg_root->IsSVGRoot()); |
| 160 EXPECT_TRUE( |
| 161 ToLayoutBoxModelObject(svg_root)->Layer()->SupportsSubsequenceCaching()); |
| 162 } |
| 163 |
148 } // namespace blink | 164 } // namespace blink |
OLD | NEW |