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

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

Issue 2290903002: Change (Pass)RefPtr<SkXxx> into sk_sp<SkXxx>. (Closed)
Patch Set: Rebasing... Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/DisplayItemList.h" 5 #include "platform/graphics/paint/DisplayItemList.h"
6 6
7 #include "SkPictureRecorder.h" 7 #include "SkPictureRecorder.h"
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "platform/graphics/paint/SubsequenceDisplayItem.h" 10 #include "platform/graphics/paint/SubsequenceDisplayItem.h"
(...skipping 17 matching lines...) Expand all
28 28
29 class DisplayItemListTest : public ::testing::Test { 29 class DisplayItemListTest : public ::testing::Test {
30 public: 30 public:
31 DisplayItemListTest() 31 DisplayItemListTest()
32 : m_list(kDefaultListBytes) {} 32 : m_list(kDefaultListBytes) {}
33 33
34 DisplayItemList m_list; 34 DisplayItemList m_list;
35 FakeDisplayItemClient m_client; 35 FakeDisplayItemClient m_client;
36 }; 36 };
37 37
38 static PassRefPtr<SkPicture> createRectPicture(const IntRect& bounds) 38 static sk_sp<SkPicture> createRectPicture(const IntRect& bounds)
39 { 39 {
40 SkPictureRecorder recorder; 40 SkPictureRecorder recorder;
41 SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height()); 41 SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height());
42 canvas->drawRect(SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(), bo unds.height()), 42 canvas->drawRect(SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(), bo unds.height()),
43 SkPaint()); 43 SkPaint());
44 return fromSkSp(recorder.finishRecordingAsPicture()); 44 return recorder.finishRecordingAsPicture();
45 } 45 }
46 46
47 TEST_F(DisplayItemListTest, AppendVisualRect_Simple) 47 TEST_F(DisplayItemListTest, AppendVisualRect_Simple)
48 { 48 {
49 IntRect drawingBounds(5, 6, 7, 8); 49 IntRect drawingBounds(5, 6, 7, 8);
50 m_list.allocateAndConstruct<DrawingDisplayItem>( 50 m_list.allocateAndConstruct<DrawingDisplayItem>(
51 m_client, DisplayItem::Type::kDocumentBackground, createRectPicture(draw ingBounds), true); 51 m_client, DisplayItem::Type::kDocumentBackground, createRectPicture(draw ingBounds), true);
52 m_list.appendVisualRect(drawingBounds); 52 m_list.appendVisualRect(drawingBounds);
53 53
54 EXPECT_EQ(static_cast<size_t>(1), m_list.size()); 54 EXPECT_EQ(static_cast<size_t>(1), m_list.size());
(...skipping 20 matching lines...) Expand all
75 m_list.allocateAndConstruct<EndSubsequenceDisplayItem>(m_client); 75 m_list.allocateAndConstruct<EndSubsequenceDisplayItem>(m_client);
76 m_list.appendVisualRect(subsequenceBounds); 76 m_list.appendVisualRect(subsequenceBounds);
77 77
78 EXPECT_EQ(static_cast<size_t>(3), m_list.size()); 78 EXPECT_EQ(static_cast<size_t>(3), m_list.size());
79 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(0)); 79 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(0));
80 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(1)); 80 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(1));
81 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(2)); 81 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(2));
82 } 82 }
83 } // namespace 83 } // namespace
84 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698