OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/GraphicsScreen.h" |
9 #include "platform/graphics/paint/CachedDisplayItem.h" | 10 #include "platform/graphics/paint/CachedDisplayItem.h" |
10 #include "platform/graphics/paint/ClipPathRecorder.h" | 11 #include "platform/graphics/paint/ClipPathRecorder.h" |
11 #include "platform/graphics/paint/ClipRecorder.h" | 12 #include "platform/graphics/paint/ClipRecorder.h" |
12 #include "platform/graphics/paint/DrawingDisplayItem.h" | 13 #include "platform/graphics/paint/DrawingDisplayItem.h" |
13 #include "platform/graphics/paint/DrawingRecorder.h" | 14 #include "platform/graphics/paint/DrawingRecorder.h" |
14 #include "platform/graphics/paint/SubsequenceRecorder.h" | 15 #include "platform/graphics/paint/SubsequenceRecorder.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class PaintControllerTest : public ::testing::Test { | 20 class PaintControllerTest : public ::testing::Test { |
20 public: | 21 public: |
21 PaintControllerTest() | 22 PaintControllerTest() |
22 : m_paintController(PaintController::create()) | 23 : m_paintController(PaintController::create()) |
23 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } | 24 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } |
24 | 25 |
25 protected: | 26 protected: |
26 PaintController& paintController() { return *m_paintController; } | 27 PaintController& paintController() |
| 28 { |
| 29 setCurrentScreenId(ScreenDevice::sRGBTest); |
| 30 return *m_paintController; |
| 31 } |
27 | 32 |
28 private: | 33 private: |
29 void TearDown() override | 34 void TearDown() override |
30 { | 35 { |
31 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); | 36 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); |
32 } | 37 } |
33 | 38 |
34 OwnPtr<PaintController> m_paintController; | 39 OwnPtr<PaintController> m_paintController; |
35 bool m_originalSlimmingPaintV2Enabled; | 40 bool m_originalSlimmingPaintV2Enabled; |
36 }; | 41 }; |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 778 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
774 | 779 |
775 paintController().commitNewDisplayItems(); | 780 paintController().commitNewDisplayItems(); |
776 const auto& paintChunks = paintController().paintChunks(); | 781 const auto& paintChunks = paintController().paintChunks(); |
777 ASSERT_EQ(1u, paintChunks.size()); | 782 ASSERT_EQ(1u, paintChunks.size()); |
778 EXPECT_EQ(0u, paintChunks[0].beginIndex); | 783 EXPECT_EQ(0u, paintChunks[0].beginIndex); |
779 EXPECT_EQ(1u, paintChunks[0].endIndex); | 784 EXPECT_EQ(1u, paintChunks[0].endIndex); |
780 } | 785 } |
781 | 786 |
782 } // namespace blink | 787 } // namespace blink |
OLD | NEW |