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

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

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix compile Created 6 years 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
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/ClipRecorder.h" 6 #include "core/paint/LayerClipRecorder.h"
7 7
8 #include "core/rendering/RenderView.h" 8 #include "core/rendering/RenderView.h"
9 #include "core/rendering/RenderingTestHelper.h" 9 #include "core/rendering/RenderingTestHelper.h"
10 #include "core/rendering/compositing/RenderLayerCompositor.h" 10 #include "core/rendering/compositing/RenderLayerCompositor.h"
11 #include "platform/graphics/GraphicsContext.h" 11 #include "platform/graphics/GraphicsContext.h"
12 #include <gtest/gtest.h> 12 #include <gtest/gtest.h>
13 13
14 namespace blink { 14 namespace blink {
15 namespace { 15 namespace {
16 16
17 class ClipRecorderTest : public RenderingTest { 17 class LayerClipRecorderTest : public RenderingTest {
18 public: 18 public:
19 ClipRecorderTest() : m_renderView(nullptr) { } 19 LayerClipRecorderTest() : m_renderView(nullptr) { }
20 20
21 protected: 21 protected:
22 RenderView* renderView() { return m_renderView; } 22 RenderView* renderView() { return m_renderView; }
23 23
24 private: 24 private:
25 virtual void SetUp() override 25 virtual void SetUp() override
26 { 26 {
27 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); 27 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
28 28
29 RenderingTest::SetUp(); 29 RenderingTest::SetUp();
30 30
31 m_renderView = document().view()->renderView(); 31 m_renderView = document().view()->renderView();
32 ASSERT_TRUE(m_renderView); 32 ASSERT_TRUE(m_renderView);
33 } 33 }
34 34
35 RenderView* m_renderView; 35 RenderView* m_renderView;
36 }; 36 };
37 37
38 void drawClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound) 38 void drawClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound)
39 { 39 {
40 IntRect rect(1, 1, 9, 9); 40 IntRect rect(1, 1, 9, 9);
41 ClipRect clipRect(rect); 41 ClipRect clipRect(rect);
42 ClipRecorder clipRecorder(renderer->compositor()->rootRenderLayer()->rendere r(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(), Pain tLayerFlags()); 42 LayerClipRecorder LayerClipRecorder(renderer->compositor()->rootRenderLayer( )->renderer(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoi nt(), PaintLayerFlags());
43 } 43 }
44 44
45 TEST_F(ClipRecorderTest, ClipRecorderTest_Single) 45 TEST_F(LayerClipRecorderTest, LayerClipRecorderTest_Single)
46 { 46 {
47 GraphicsContext* context = new GraphicsContext(nullptr); 47 GraphicsContext* context = new GraphicsContext(nullptr);
48 FloatRect bound = renderView()->viewRect(); 48 FloatRect bound = renderView()->viewRect();
49 EXPECT_EQ((size_t)0, renderView()->viewDisplayList().paintList().size()); 49 EXPECT_EQ((size_t)0, renderView()->viewDisplayList().paintList().size());
50 50
51 drawClip(context, renderView(), PaintPhaseForeground, bound); 51 drawClip(context, renderView(), PaintPhaseForeground, bound);
52 EXPECT_EQ((size_t)2, renderView()->viewDisplayList().paintList().size()); 52 EXPECT_EQ((size_t)2, renderView()->viewDisplayList().paintList().size());
53 } 53 }
54 54
55 } 55 }
56 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698