Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp

Issue 1508223005: Client side display item cache flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/paint/CachedDisplayItem.h" 9 #include "platform/graphics/paint/CachedDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathRecorder.h" 10 #include "platform/graphics/paint/ClipPathRecorder.h"
11 #include "platform/graphics/paint/ClipRecorder.h" 11 #include "platform/graphics/paint/ClipRecorder.h"
12 #include "platform/graphics/paint/DrawingDisplayItem.h" 12 #include "platform/graphics/paint/DrawingDisplayItem.h"
13 #include "platform/graphics/paint/DrawingRecorder.h" 13 #include "platform/graphics/paint/DrawingRecorder.h"
14 #include "platform/graphics/paint/SubsequenceRecorder.h" 14 #include "platform/graphics/paint/SubsequenceRecorder.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class PaintControllerTest : public ::testing::Test { 19 class PaintControllerTest : public ::testing::Test {
20 public: 20 public:
21 PaintControllerTest() 21 PaintControllerTest()
22 : m_paintController(PaintController::create()) 22 : m_paintController(PaintController::create())
23 , m_originalSlimmingPaintSynchronizedPaintingEnabled(RuntimeEnabledFeatu res::slimmingPaintSynchronizedPaintingEnabled()) 23 , m_originalSlimmingPaintSynchronizedPaintingEnabled(RuntimeEnabledFeatu res::slimmingPaintSynchronizedPaintingEnabled())
24 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled()) { } 24 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled())
25 {
26 m_paintController->setCanUseClientCacheStatus(true);
27 }
25 28
26 protected: 29 protected:
27 PaintController& paintController() { return *m_paintController; } 30 PaintController& paintController() { return *m_paintController; }
28 31
29 private: 32 private:
30 void TearDown() override 33 void TearDown() override
31 { 34 {
32 RuntimeEnabledFeatures::setSlimmingPaintSynchronizedPaintingEnabled(m_or iginalSlimmingPaintSynchronizedPaintingEnabled); 35 RuntimeEnabledFeatures::setSlimmingPaintSynchronizedPaintingEnabled(m_or iginalSlimmingPaintSynchronizedPaintingEnabled);
33 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled); 36 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled);
34 } 37 }
(...skipping 10 matching lines...) Expand all
45 class TestDisplayItemClient : public DisplayItemClient { 48 class TestDisplayItemClient : public DisplayItemClient {
46 public: 49 public:
47 TestDisplayItemClient(const String& name) 50 TestDisplayItemClient(const String& name)
48 : m_name(name) 51 : m_name(name)
49 { } 52 { }
50 53
51 String debugName() const final { return m_name; } 54 String debugName() const final { return m_name; }
52 IntRect visualRect() const override { return IntRect(); } 55 IntRect visualRect() const override { return IntRect(); }
53 56
54 private: 57 private:
58 DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION
55 String m_name; 59 String m_name;
56 }; 60 };
57 61
58 class TestDisplayItem final : public DisplayItem { 62 class TestDisplayItem final : public DisplayItem {
59 public: 63 public:
60 TestDisplayItem(const TestDisplayItemClient& client, Type type) : DisplayIte m(client, type, sizeof(*this)) { } 64 TestDisplayItem(const TestDisplayItemClient& client, Type type) : DisplayIte m(client, type, sizeof(*this)) { }
61 65
62 void replay(GraphicsContext&) const final { ASSERT_NOT_REACHED(); } 66 void replay(GraphicsContext&) const final { ASSERT_NOT_REACHED(); }
63 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const f inal { ASSERT_NOT_REACHED(); } 67 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const f inal { ASSERT_NOT_REACHED(); }
64 }; 68 };
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 784 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100));
781 785
782 paintController().commitNewDisplayItems(); 786 paintController().commitNewDisplayItems();
783 const auto& paintChunks = paintController().paintChunks(); 787 const auto& paintChunks = paintController().paintChunks();
784 ASSERT_EQ(1u, paintChunks.size()); 788 ASSERT_EQ(1u, paintChunks.size());
785 EXPECT_EQ(0u, paintChunks[0].beginIndex); 789 EXPECT_EQ(0u, paintChunks[0].beginIndex);
786 EXPECT_EQ(1u, paintChunks[0].endIndex); 790 EXPECT_EQ(1u, paintChunks[0].endIndex);
787 } 791 }
788 792
789 } // namespace blink 793 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698