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

Side by Side Diff: cc/layers/painted_scrollbar_layer_unittest.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl.cc ('k') | cc/layers/picture_image_layer.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "cc/layers/painted_scrollbar_layer.h" 5 #include "cc/layers/painted_scrollbar_layer.h"
6 6
7 #include "cc/test/fake_layer_tree_host.h" 7 #include "cc/test/fake_layer_tree_host.h"
8 #include "cc/test/fake_layer_tree_host_client.h" 8 #include "cc/test/fake_layer_tree_host_client.h"
9 #include "cc/test/fake_scrollbar.h" 9 #include "cc/test/fake_scrollbar.h"
10 #include "cc/test/test_task_graph_runner.h" 10 #include "cc/test/test_task_graph_runner.h"
(...skipping 11 matching lines...) Expand all
22 MockScrollbar() : FakeScrollbar(true, true, true) {} 22 MockScrollbar() : FakeScrollbar(true, true, true) {}
23 MOCK_METHOD3(PaintPart, 23 MOCK_METHOD3(PaintPart,
24 void(SkCanvas* canvas, 24 void(SkCanvas* canvas,
25 ScrollbarPart part, 25 ScrollbarPart part,
26 const gfx::Rect& content_rect)); 26 const gfx::Rect& content_rect));
27 }; 27 };
28 28
29 TEST(PaintedScrollbarLayerTest, NeedsPaint) { 29 TEST(PaintedScrollbarLayerTest, NeedsPaint) {
30 FakeLayerTreeHostClient fake_client_(FakeLayerTreeHostClient::DIRECT_3D); 30 FakeLayerTreeHostClient fake_client_(FakeLayerTreeHostClient::DIRECT_3D);
31 TestTaskGraphRunner task_graph_runner_; 31 TestTaskGraphRunner task_graph_runner_;
32 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; 32 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_;
33 33
34 layer_tree_host_ = 34 layer_tree_host_ =
35 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); 35 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_);
36 RendererCapabilities renderer_capabilities; 36 RendererCapabilities renderer_capabilities;
37 renderer_capabilities.max_texture_size = 2048; 37 renderer_capabilities.max_texture_size = 2048;
38 layer_tree_host_->set_renderer_capabilities(renderer_capabilities); 38 layer_tree_host_->set_renderer_capabilities(renderer_capabilities);
39 39
40 MockScrollbar* scrollbar = new MockScrollbar(); 40 MockScrollbar* scrollbar = new MockScrollbar();
41 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer = 41 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer =
42 PaintedScrollbarLayer::Create(scoped_ptr<Scrollbar>(scrollbar), 1); 42 PaintedScrollbarLayer::Create(std::unique_ptr<Scrollbar>(scrollbar), 1);
43 43
44 scrollbar_layer->SetIsDrawable(true); 44 scrollbar_layer->SetIsDrawable(true);
45 scrollbar_layer->SetBounds(gfx::Size(100, 100)); 45 scrollbar_layer->SetBounds(gfx::Size(100, 100));
46 46
47 layer_tree_host_->SetRootLayer(scrollbar_layer); 47 layer_tree_host_->SetRootLayer(scrollbar_layer);
48 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); 48 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get());
49 scrollbar_layer->SavePaintProperties(); 49 scrollbar_layer->SavePaintProperties();
50 50
51 // Request no paint, but expect them to be painted because they have not 51 // Request no paint, but expect them to be painted because they have not
52 // yet been initialized. 52 // yet been initialized.
(...skipping 22 matching lines...) Expand all
75 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(0); 75 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(0);
76 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); 76 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1);
77 scrollbar->set_needs_paint_thumb(false); 77 scrollbar->set_needs_paint_thumb(false);
78 scrollbar->set_needs_paint_track(true); 78 scrollbar->set_needs_paint_track(true);
79 scrollbar_layer->Update(); 79 scrollbar_layer->Update();
80 Mock::VerifyAndClearExpectations(scrollbar); 80 Mock::VerifyAndClearExpectations(scrollbar);
81 } 81 }
82 82
83 } // namespace 83 } // namespace
84 } // namespace cc 84 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl.cc ('k') | cc/layers/picture_image_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698