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

Side by Side Diff: blimp/net/thread_pipe_manager_unittest.cc

Issue 2250433006: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 | « blimp/net/tcp_engine_transport.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "blimp/net/thread_pipe_manager.h" 5 #include "blimp/net/thread_pipe_manager.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // with one it just sent. 92 // with one it just sent.
93 class FakeBrowserConnectionHandler : public BrowserConnectionHandler { 93 class FakeBrowserConnectionHandler : public BrowserConnectionHandler {
94 public: 94 public:
95 FakeBrowserConnectionHandler( 95 FakeBrowserConnectionHandler(
96 const scoped_refptr<base::SequencedTaskRunner>& task_runner) 96 const scoped_refptr<base::SequencedTaskRunner>& task_runner)
97 : task_runner_(task_runner) {} 97 : task_runner_(task_runner) {}
98 std::unique_ptr<BlimpMessageProcessor> RegisterFeature( 98 std::unique_ptr<BlimpMessageProcessor> RegisterFeature(
99 BlimpMessage::FeatureCase feature_case, 99 BlimpMessage::FeatureCase feature_case,
100 BlimpMessageProcessor* incoming_processor) override { 100 BlimpMessageProcessor* incoming_processor) override {
101 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 101 DCHECK(task_runner_->RunsTasksOnCurrentThread());
102 return base::WrapUnique( 102 return base::MakeUnique<FakeFeaturePeer>(feature_case, incoming_processor,
103 new FakeFeaturePeer(feature_case, incoming_processor, task_runner_)); 103 task_runner_);
104 } 104 }
105 105
106 private: 106 private:
107 scoped_refptr<base::SequencedTaskRunner> task_runner_; 107 scoped_refptr<base::SequencedTaskRunner> task_runner_;
108 }; 108 };
109 109
110 } // namespace 110 } // namespace
111 111
112 class ThreadPipeManagerTest : public testing::Test { 112 class ThreadPipeManagerTest : public testing::Test {
113 public: 113 public:
114 ThreadPipeManagerTest() : thread_("IoThread") {} 114 ThreadPipeManagerTest() : thread_("IoThread") {}
115 115
116 ~ThreadPipeManagerTest() override {} 116 ~ThreadPipeManagerTest() override {}
117 117
118 void SetUp() override { 118 void SetUp() override {
119 ASSERT_TRUE(thread_.Start()); 119 ASSERT_TRUE(thread_.Start());
120 connection_handler_ = base::WrapUnique( 120 connection_handler_ =
121 new FakeBrowserConnectionHandler(thread_.task_runner())); 121 base::MakeUnique<FakeBrowserConnectionHandler>(thread_.task_runner());
122 pipe_manager_ = base::WrapUnique(new ThreadPipeManager( 122 pipe_manager_ = base::MakeUnique<ThreadPipeManager>(
123 thread_.task_runner(), connection_handler_.get())); 123 thread_.task_runner(), connection_handler_.get());
124 124
125 input_feature_.reset( 125 input_feature_.reset(
126 new FakeFeature(BlimpMessage::kInput, pipe_manager_.get())); 126 new FakeFeature(BlimpMessage::kInput, pipe_manager_.get()));
127 tab_control_feature_.reset( 127 tab_control_feature_.reset(
128 new FakeFeature(BlimpMessage::kTabControl, pipe_manager_.get())); 128 new FakeFeature(BlimpMessage::kTabControl, pipe_manager_.get()));
129 } 129 }
130 130
131 void TearDown() override { SynchronizeWithThread(); } 131 void TearDown() override { SynchronizeWithThread(); }
132 132
133 // Synchronize with |thread_| to ensure that any pending work is done. 133 // Synchronize with |thread_| to ensure that any pending work is done.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 std::move(input_message), cb1.callback()); 170 std::move(input_message), cb1.callback());
171 net::TestCompletionCallback cb2; 171 net::TestCompletionCallback cb2;
172 tab_control_feature_->outgoing_message_processor()->ProcessMessage( 172 tab_control_feature_->outgoing_message_processor()->ProcessMessage(
173 std::move(tab_control_message), cb2.callback()); 173 std::move(tab_control_message), cb2.callback());
174 174
175 EXPECT_EQ(net::OK, cb1.WaitForResult()); 175 EXPECT_EQ(net::OK, cb1.WaitForResult());
176 EXPECT_EQ(net::OK, cb2.WaitForResult()); 176 EXPECT_EQ(net::OK, cb2.WaitForResult());
177 } 177 }
178 178
179 } // namespace blimp 179 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/tcp_engine_transport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698