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

Side by Side Diff: ui/views/border_unittest.cc

Issue 2476113002: Change call-sites now that SkCanvas is not ref-counted (Closed)
Patch Set: try fixing win again Created 4 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
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 "ui/views/border.h" 5 #include "ui/views/border.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 class BorderTest : public ViewsTestBase { 126 class BorderTest : public ViewsTestBase {
127 public: 127 public:
128 void SetUp() override { 128 void SetUp() override {
129 ViewsTestBase::SetUp(); 129 ViewsTestBase::SetUp();
130 130
131 view_.reset(new views::View()); 131 view_.reset(new views::View());
132 view_->SetSize(gfx::Size(100, 50)); 132 view_->SetSize(gfx::Size(100, 50));
133 // The canvas should be much bigger than the view. 133 // The canvas should be much bigger than the view.
134 sk_canvas_.reset(new MockCanvas(1000, 500)); 134 sk_canvas_.reset(new MockCanvas(1000, 500));
135 canvas_.reset(new gfx::Canvas(sk_canvas_, 1.0f)); 135 canvas_.reset(new gfx::Canvas(sk_canvas_.get(), 1.0f));
136 } 136 }
137 137
138 void TearDown() override { 138 void TearDown() override {
139 ViewsTestBase::TearDown(); 139 ViewsTestBase::TearDown();
140 140
141 canvas_.reset(); 141 canvas_.reset();
142 sk_canvas_.reset(); 142 sk_canvas_.reset();
143 view_.reset(); 143 view_.reset();
144 } 144 }
145 145
146 protected: 146 protected:
147 std::unique_ptr<views::View> view_; 147 std::unique_ptr<views::View> view_;
148 sk_sp<MockCanvas> sk_canvas_; 148 std::unique_ptr<MockCanvas> sk_canvas_;
149 std::unique_ptr<gfx::Canvas> canvas_; 149 std::unique_ptr<gfx::Canvas> canvas_;
150 }; 150 };
151 151
152 TEST_F(BorderTest, NullBorder) { 152 TEST_F(BorderTest, NullBorder) {
153 std::unique_ptr<Border> border(NullBorder()); 153 std::unique_ptr<Border> border(NullBorder());
154 EXPECT_FALSE(border); 154 EXPECT_FALSE(border);
155 } 155 }
156 156
157 TEST_F(BorderTest, SolidBorder) { 157 TEST_F(BorderTest, SolidBorder) {
158 std::unique_ptr<Border> border(CreateSolidBorder(3, SK_ColorBLUE)); 158 std::unique_ptr<Border> border(CreateSolidBorder(3, SK_ColorBLUE));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 EXPECT_EQ(kInsets, border->GetInsets()); 245 EXPECT_EQ(kInsets, border->GetInsets());
246 246
247 border->Paint(*view_, canvas_.get()); 247 border->Paint(*view_, canvas_.get());
248 248
249 // Expect that the Painter was called with our canvas and the view's size. 249 // Expect that the Painter was called with our canvas and the view's size.
250 EXPECT_EQ(canvas_.get(), painter_ptr->given_canvas()); 250 EXPECT_EQ(canvas_.get(), painter_ptr->given_canvas());
251 EXPECT_EQ(view_->size(), painter_ptr->given_size()); 251 EXPECT_EQ(view_->size(), painter_ptr->given_size());
252 } 252 }
253 253
254 } // namespace views 254 } // namespace views
OLDNEW
« cc/trees/layer_tree_host_pixeltest_masks.cc ('K') | « ui/surface/transport_dib_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698