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

Unified Diff: remoting/protocol/fake_stream_socket.cc

Issue 1531983002: Replace ice_connection_to_client_unittest.cc with connection_unittest.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/fake_stream_socket.h ('k') | remoting/protocol/ice_connection_to_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_stream_socket.cc
diff --git a/remoting/protocol/fake_stream_socket.cc b/remoting/protocol/fake_stream_socket.cc
index b857ca1a1546c992a994a6972f430f651c9c60e4..12b771229b19d41b269b9e17f345c2c600d51c85 100644
--- a/remoting/protocol/fake_stream_socket.cc
+++ b/remoting/protocol/fake_stream_socket.cc
@@ -169,12 +169,24 @@ FakeStreamSocket* FakeStreamChannelFactory::GetFakeChannel(
return channels_[name].get();
}
+void FakeStreamChannelFactory::PairWith(
+ FakeStreamChannelFactory* peer_factory) {
+ peer_factory_ = peer_factory->weak_factory_.GetWeakPtr();
+ peer_factory->peer_factory_ = weak_factory_.GetWeakPtr();
+}
+
void FakeStreamChannelFactory::CreateChannel(
const std::string& name,
const ChannelCreatedCallback& callback) {
scoped_ptr<FakeStreamSocket> channel(new FakeStreamSocket());
channels_[name] = channel->GetWeakPtr();
+ if (peer_factory_) {
+ FakeStreamSocket* peer_channel = peer_factory_->GetFakeChannel(name);
+ if (peer_channel)
+ channel->PairWith(peer_channel);
+ }
+
if (fail_create_)
channel.reset();
« no previous file with comments | « remoting/protocol/fake_stream_socket.h ('k') | remoting/protocol/ice_connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698