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

Side by Side Diff: cc/trees/layer_tree_host_unittest_remote_server.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
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 "cc/trees/layer_tree_host.h" 5 #include <memory>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "cc/test/fake_image_serialization_processor.h" 9 #include "cc/test/fake_image_serialization_processor.h"
10 #include "cc/test/test_task_graph_runner.h" 10 #include "cc/test/test_task_graph_runner.h"
11 #include "cc/trees/layer_tree_host.h"
11 #include "cc/trees/layer_tree_host_client.h" 12 #include "cc/trees/layer_tree_host_client.h"
12 #include "cc/trees/proxy_common.h" 13 #include "cc/trees/proxy_common.h"
13 #include "cc/trees/proxy_main.h" 14 #include "cc/trees/proxy_main.h"
14 #include "cc/trees/remote_proto_channel.h" 15 #include "cc/trees/remote_proto_channel.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace cc { 18 namespace cc {
18 namespace { 19 namespace {
19 20
20 class LayerTreeHostTestRemoteServer : public testing::Test, 21 class LayerTreeHostTestRemoteServer : public testing::Test,
21 public RemoteProtoChannel, 22 public RemoteProtoChannel,
22 public LayerTreeHostClient { 23 public LayerTreeHostClient {
23 public: 24 public:
24 LayerTreeHostTestRemoteServer() 25 LayerTreeHostTestRemoteServer()
25 : calls_received_(0), 26 : calls_received_(0),
26 image_serialization_processor_( 27 image_serialization_processor_(
27 make_scoped_ptr(new FakeImageSerializationProcessor)) { 28 base::WrapUnique(new FakeImageSerializationProcessor)) {
28 LayerTreeHost::InitParams params; 29 LayerTreeHost::InitParams params;
29 params.client = this; 30 params.client = this;
30 params.task_graph_runner = &task_graph_runner_; 31 params.task_graph_runner = &task_graph_runner_;
31 params.settings = &settings_; 32 params.settings = &settings_;
32 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 33 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
33 params.image_serialization_processor = image_serialization_processor_.get(); 34 params.image_serialization_processor = image_serialization_processor_.get();
34 layer_tree_host_ = LayerTreeHost::CreateRemoteServer(this, &params); 35 layer_tree_host_ = LayerTreeHost::CreateRemoteServer(this, &params);
35 } 36 }
36 37
37 ~LayerTreeHostTestRemoteServer() override {} 38 ~LayerTreeHostTestRemoteServer() override {}
(...skipping 10 matching lines...) Expand all
48 float page_scale, 49 float page_scale,
49 float top_controls_delta) override {} 50 float top_controls_delta) override {}
50 void RequestNewOutputSurface() override { NOTREACHED(); } 51 void RequestNewOutputSurface() override { NOTREACHED(); }
51 void DidInitializeOutputSurface() override { NOTREACHED(); } 52 void DidInitializeOutputSurface() override { NOTREACHED(); }
52 void DidFailToInitializeOutputSurface() override { NOTREACHED(); } 53 void DidFailToInitializeOutputSurface() override { NOTREACHED(); }
53 void WillCommit() override {} 54 void WillCommit() override {}
54 void DidCommit() override {} 55 void DidCommit() override {}
55 void DidCommitAndDrawFrame() override {} 56 void DidCommitAndDrawFrame() override {}
56 void DidCompleteSwapBuffers() override {} 57 void DidCompleteSwapBuffers() override {}
57 void RecordFrameTimingEvents( 58 void RecordFrameTimingEvents(
58 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 59 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
59 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) 60 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events)
60 override{}; 61 override{};
61 void DidCompletePageScaleAnimation() override {} 62 void DidCompletePageScaleAnimation() override {}
62 void SendBeginFramesToChildren(const BeginFrameArgs& args) override {} 63 void SendBeginFramesToChildren(const BeginFrameArgs& args) override {}
63 64
64 // RemoteProtoChannel implementation 65 // RemoteProtoChannel implementation
65 void SetProtoReceiver(RemoteProtoChannel::ProtoReceiver* receiver) override { 66 void SetProtoReceiver(RemoteProtoChannel::ProtoReceiver* receiver) override {
66 receiver_ = receiver; 67 receiver_ = receiver;
67 } 68 }
68 void SendCompositorProto(const proto::CompositorMessage& proto) override {} 69 void SendCompositorProto(const proto::CompositorMessage& proto) override {}
69 70
70 int calls_received_; 71 int calls_received_;
71 TestTaskGraphRunner task_graph_runner_; 72 TestTaskGraphRunner task_graph_runner_;
72 LayerTreeSettings settings_; 73 LayerTreeSettings settings_;
73 scoped_ptr<LayerTreeHost> layer_tree_host_; 74 std::unique_ptr<LayerTreeHost> layer_tree_host_;
74 RemoteProtoChannel::ProtoReceiver* receiver_; 75 RemoteProtoChannel::ProtoReceiver* receiver_;
75 scoped_ptr<FakeImageSerializationProcessor> image_serialization_processor_; 76 std::unique_ptr<FakeImageSerializationProcessor>
77 image_serialization_processor_;
76 78
77 private: 79 private:
78 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostTestRemoteServer); 80 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostTestRemoteServer);
79 }; 81 };
80 82
81 class LayerTreeHostTestRemoteServerBeginMainFrame 83 class LayerTreeHostTestRemoteServerBeginMainFrame
82 : public LayerTreeHostTestRemoteServer { 84 : public LayerTreeHostTestRemoteServer {
83 protected: 85 protected:
84 void BeginMainFrame(const BeginFrameArgs& args) override { 86 void BeginMainFrame(const BeginFrameArgs& args) override {
85 calls_received_++; 87 calls_received_++;
86 } 88 }
87 }; 89 };
88 90
89 // Makes sure that the BeginMainFrame call is not aborted on the server. 91 // Makes sure that the BeginMainFrame call is not aborted on the server.
90 // See crbug.com/577301. 92 // See crbug.com/577301.
91 TEST_F(LayerTreeHostTestRemoteServerBeginMainFrame, BeginMainFrameNotAborted) { 93 TEST_F(LayerTreeHostTestRemoteServerBeginMainFrame, BeginMainFrameNotAborted) {
92 layer_tree_host_->SetVisible(true); 94 layer_tree_host_->SetVisible(true);
93 95
94 scoped_ptr<BeginMainFrameAndCommitState> begin_frame_state; 96 std::unique_ptr<BeginMainFrameAndCommitState> begin_frame_state;
95 begin_frame_state.reset(new BeginMainFrameAndCommitState()); 97 begin_frame_state.reset(new BeginMainFrameAndCommitState());
96 begin_frame_state->scroll_info.reset(new ScrollAndScaleSet()); 98 begin_frame_state->scroll_info.reset(new ScrollAndScaleSet());
97 99
98 static_cast<ProxyMain*>(layer_tree_host_->proxy()) 100 static_cast<ProxyMain*>(layer_tree_host_->proxy())
99 ->BeginMainFrame(std::move(begin_frame_state)); 101 ->BeginMainFrame(std::move(begin_frame_state));
100 EXPECT_EQ(calls_received_, 1); 102 EXPECT_EQ(calls_received_, 1);
101 } 103 }
102 104
103 } // namespace 105 } // namespace
104 } // namespace cc 106 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_record_gpu_histogram.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698