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

Side by Side Diff: Source/core/paint/DrawingRecorderTest.cpp

Issue 723103002: Revert "Move ViewDisplayList to GraphicsLayer" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/DrawingRecorder.cpp ('k') | Source/core/paint/ViewDisplayList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/paint/DrawingRecorder.h" 6 #include "core/paint/DrawingRecorder.h"
7 7
8 #include "core/rendering/RenderLayer.h"
9 #include "core/rendering/RenderView.h" 8 #include "core/rendering/RenderView.h"
10 #include "core/rendering/RenderingTestHelper.h" 9 #include "core/rendering/RenderingTestHelper.h"
11 #include "platform/graphics/GraphicsContext.h" 10 #include "platform/graphics/GraphicsContext.h"
12 #include "platform/graphics/GraphicsLayer.h"
13 #include "platform/graphics/paint/DisplayItemList.h"
14 #include <gtest/gtest.h> 11 #include <gtest/gtest.h>
15 12
16 namespace blink { 13 namespace blink {
17 namespace { 14 namespace {
18 15
19 class DrawingRecorderTest : public RenderingTest { 16 class DrawingRecorderTest : public RenderingTest {
20 public: 17 public:
21 DrawingRecorderTest() : m_renderView(nullptr) { } 18 DrawingRecorderTest() : m_renderView(nullptr) { }
22 19
23 protected: 20 protected:
24 RenderView* renderView() { return m_renderView; } 21 RenderView* renderView() { return m_renderView; }
25 DisplayItemList& rootDisplayItemList() { return renderView()->layer()->graph icsLayerBacking()->displayItemList(); }
26 22
27 private: 23 private:
28 virtual void SetUp() override 24 virtual void SetUp() override
29 { 25 {
30 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); 26 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
31 27
32 RenderingTest::SetUp(); 28 RenderingTest::SetUp();
33 enableCompositing();
34 29
35 m_renderView = document().view()->renderView(); 30 m_renderView = document().view()->renderView();
36 ASSERT_TRUE(m_renderView); 31 ASSERT_TRUE(m_renderView);
37 } 32 }
38 33
39 RenderView* m_renderView; 34 RenderView* m_renderView;
40 }; 35 };
41 36
42 void drawNothing(GraphicsContext* context, RenderView* renderer, PaintPhase phas e, const FloatRect& bound) 37 void drawNothing(GraphicsContext* context, RenderView* renderer, PaintPhase phas e, const FloatRect& bound)
43 { 38 {
44 DrawingRecorder drawingRecorder(context, renderer, phase, bound); 39 DrawingRecorder drawingRecorder(context, renderer, phase, bound);
45 } 40 }
46 41
47 void drawRect(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound) 42 void drawRect(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound)
48 { 43 {
49 DrawingRecorder drawingRecorder(context, renderer, phase, bound); 44 DrawingRecorder drawingRecorder(context, renderer, phase, bound);
50 IntRect rect(0, 0, 10, 10); 45 IntRect rect(0, 0, 10, 10);
51 context->drawRect(rect); 46 context->drawRect(rect);
52 } 47 }
53 48
54 49
55 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing) 50 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing)
56 { 51 {
57 GraphicsContext* context = new GraphicsContext(nullptr); 52 GraphicsContext* context = new GraphicsContext(nullptr);
58 FloatRect bound = renderView()->viewRect(); 53 FloatRect bound = renderView()->viewRect();
59 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); 54 EXPECT_EQ((size_t)0, renderView()->viewDisplayList().paintList().size());
60 55
61 drawNothing(context, renderView(), PaintPhaseForeground, bound); 56 drawNothing(context, renderView(), PaintPhaseForeground, bound);
62 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); 57 EXPECT_EQ((size_t)0, renderView()->viewDisplayList().paintList().size());
63 } 58 }
64 59
65 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect) 60 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect)
66 { 61 {
67 GraphicsContext* context = new GraphicsContext(nullptr); 62 GraphicsContext* context = new GraphicsContext(nullptr);
68 FloatRect bound = renderView()->viewRect(); 63 FloatRect bound = renderView()->viewRect();
69 drawRect(context, renderView(), PaintPhaseForeground, bound); 64 drawRect(context, renderView(), PaintPhaseForeground, bound);
70 EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size()); 65 EXPECT_EQ((size_t)1, renderView()->viewDisplayList().paintList().size());
71 } 66 }
72 67
73 } 68 }
74 } 69 }
OLDNEW
« no previous file with comments | « Source/core/paint/DrawingRecorder.cpp ('k') | Source/core/paint/ViewDisplayList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698