OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/graphics/paint/PaintChunker.h" | 5 #include "platform/graphics/paint/PaintChunker.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | |
8 #include "platform/testing/PaintPropertyTestHelpers.h" | 7 #include "platform/testing/PaintPropertyTestHelpers.h" |
| 8 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using ::blink::testing::createOpacityOnlyEffect; | 12 using ::blink::testing::createOpacityOnlyEffect; |
13 using ::blink::testing::defaultPaintChunkProperties; | 13 using ::blink::testing::defaultPaintChunkProperties; |
14 using ::testing::ElementsAre; | 14 using ::testing::ElementsAre; |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 namespace { | 17 namespace { |
18 | 18 |
19 class PaintChunkerTest : public ::testing::Test { | 19 class PaintChunkerTest : public ::testing::Test, |
20 protected: | 20 private ScopedSlimmingPaintV2ForTest { |
21 void SetUp() override { | 21 public: |
22 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); | 22 PaintChunkerTest() : ScopedSlimmingPaintV2ForTest(true) {} |
23 } | |
24 | |
25 void TearDown() override { m_featuresBackup.restore(); } | |
26 | 23 |
27 protected: | 24 protected: |
28 class TestDisplayItemClient : public DisplayItemClient { | 25 class TestDisplayItemClient : public DisplayItemClient { |
29 String debugName() const final { return "Test"; } | 26 String debugName() const final { return "Test"; } |
30 LayoutRect visualRect() const final { return LayoutRect(); } | 27 LayoutRect visualRect() const final { return LayoutRect(); } |
31 }; | 28 }; |
32 TestDisplayItemClient m_client; | 29 TestDisplayItemClient m_client; |
33 | |
34 private: | |
35 RuntimeEnabledFeatures::Backup m_featuresBackup; | |
36 }; | 30 }; |
37 | 31 |
38 class TestDisplayItem : public DisplayItem { | 32 class TestDisplayItem : public DisplayItem { |
39 public: | 33 public: |
40 TestDisplayItem(const DisplayItemClient& client, DisplayItem::Type type) | 34 TestDisplayItem(const DisplayItemClient& client, DisplayItem::Type type) |
41 : DisplayItem(client, type, sizeof(*this)) {} | 35 : DisplayItem(client, type, sizeof(*this)) {} |
42 | 36 |
43 void replay(GraphicsContext&) const final { NOTREACHED(); } | 37 void replay(GraphicsContext&) const final { NOTREACHED(); } |
44 void appendToWebDisplayItemList(const IntRect&, | 38 void appendToWebDisplayItemList(const IntRect&, |
45 WebDisplayItemList*) const final { | 39 WebDisplayItemList*) const final { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 chunks, | 373 chunks, |
380 ElementsAre(PaintChunk(0, 2, nullptr, defaultPaintChunkProperties()), | 374 ElementsAre(PaintChunk(0, 2, nullptr, defaultPaintChunkProperties()), |
381 PaintChunk(2, 4, nullptr, simpleTransform), | 375 PaintChunk(2, 4, nullptr, simpleTransform), |
382 PaintChunk(4, 5, nullptr, simpleTransform), | 376 PaintChunk(4, 5, nullptr, simpleTransform), |
383 PaintChunk(5, 6, nullptr, simpleTransform), | 377 PaintChunk(5, 6, nullptr, simpleTransform), |
384 PaintChunk(6, 7, nullptr, defaultPaintChunkProperties()))); | 378 PaintChunk(6, 7, nullptr, defaultPaintChunkProperties()))); |
385 } | 379 } |
386 | 380 |
387 } // namespace | 381 } // namespace |
388 } // namespace blink | 382 } // namespace blink |
OLD | NEW |