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

Side by Side Diff: remoting/protocol/fake_datagram_socket.cc

Issue 2007373004: Fix test expectations to use bool checks rather than null compares (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/protocol/fake_datagram_socket.h" 5 #include "remoting/protocol/fake_datagram_socket.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 FakeDatagramChannelFactory::FakeDatagramChannelFactory() 130 FakeDatagramChannelFactory::FakeDatagramChannelFactory()
131 : task_runner_(base::ThreadTaskRunnerHandle::Get()), 131 : task_runner_(base::ThreadTaskRunnerHandle::Get()),
132 asynchronous_create_(false), 132 asynchronous_create_(false),
133 fail_create_(false), 133 fail_create_(false),
134 weak_factory_(this) { 134 weak_factory_(this) {
135 } 135 }
136 136
137 FakeDatagramChannelFactory::~FakeDatagramChannelFactory() { 137 FakeDatagramChannelFactory::~FakeDatagramChannelFactory() {
138 for (ChannelsMap::iterator it = channels_.begin(); it != channels_.end(); 138 for (ChannelsMap::iterator it = channels_.begin(); it != channels_.end();
139 ++it) { 139 ++it) {
140 EXPECT_TRUE(it->second == nullptr); 140 EXPECT_FALSE(it->second);
141 } 141 }
142 } 142 }
143 143
144 void FakeDatagramChannelFactory::PairWith( 144 void FakeDatagramChannelFactory::PairWith(
145 FakeDatagramChannelFactory* peer_factory) { 145 FakeDatagramChannelFactory* peer_factory) {
146 peer_factory_ = peer_factory->weak_factory_.GetWeakPtr(); 146 peer_factory_ = peer_factory->weak_factory_.GetWeakPtr();
147 peer_factory_->peer_factory_ = weak_factory_.GetWeakPtr(); 147 peer_factory_->peer_factory_ = weak_factory_.GetWeakPtr();
148 } 148 }
149 149
150 FakeDatagramSocket* FakeDatagramChannelFactory::GetFakeChannel( 150 FakeDatagramSocket* FakeDatagramChannelFactory::GetFakeChannel(
151 const std::string& name) { 151 const std::string& name) {
152 return channels_[name].get(); 152 return channels_[name].get();
153 } 153 }
154 154
155 void FakeDatagramChannelFactory::CreateChannel( 155 void FakeDatagramChannelFactory::CreateChannel(
156 const std::string& name, 156 const std::string& name,
157 const ChannelCreatedCallback& callback) { 157 const ChannelCreatedCallback& callback) {
158 EXPECT_TRUE(channels_[name] == nullptr); 158 EXPECT_FALSE(channels_[name]);
159 159
160 std::unique_ptr<FakeDatagramSocket> channel(new FakeDatagramSocket()); 160 std::unique_ptr<FakeDatagramSocket> channel(new FakeDatagramSocket());
161 channels_[name] = channel->GetWeakPtr(); 161 channels_[name] = channel->GetWeakPtr();
162 162
163 if (peer_factory_) { 163 if (peer_factory_) {
164 FakeDatagramSocket* peer_socket = peer_factory_->GetFakeChannel(name); 164 FakeDatagramSocket* peer_socket = peer_factory_->GetFakeChannel(name);
165 if (peer_socket) 165 if (peer_socket)
166 channel->PairWith(peer_socket); 166 channel->PairWith(peer_socket);
167 } 167 }
168 168
(...skipping 19 matching lines...) Expand all
188 callback.Run(std::move(owned_socket)); 188 callback.Run(std::move(owned_socket));
189 } 189 }
190 190
191 void FakeDatagramChannelFactory::CancelChannelCreation( 191 void FakeDatagramChannelFactory::CancelChannelCreation(
192 const std::string& name) { 192 const std::string& name) {
193 channels_.erase(name); 193 channels_.erase(name);
194 } 194 }
195 195
196 } // namespace protocol 196 } // namespace protocol
197 } // namespace remoting 197 } // namespace remoting
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | sync/internal_api/attachments/attachment_downloader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698