| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  *  Copyright 2009 The WebRTC Project Authors. All rights reserved. |     2  *  Copyright 2009 The WebRTC Project Authors. All rights reserved. | 
|     3  * |     3  * | 
|     4  *  Use of this source code is governed by a BSD-style license |     4  *  Use of this source code is governed by a BSD-style license | 
|     5  *  that can be found in the LICENSE file in the root of the source |     5  *  that can be found in the LICENSE file in the root of the source | 
|     6  *  tree. An additional intellectual property rights grant can be found |     6  *  tree. An additional intellectual property rights grant can be found | 
|     7  *  in the file PATENTS.  All contributing project authors may |     7  *  in the file PATENTS.  All contributing project authors may | 
|     8  *  be found in the AUTHORS file in the root of the source tree. |     8  *  be found in the AUTHORS file in the root of the source tree. | 
|     9  */ |     9  */ | 
|    10  |    10  | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    85 static const SocketAddress kRelaySslTcpExtAddr("99.99.99.3", 5005); |    85 static const SocketAddress kRelaySslTcpExtAddr("99.99.99.3", 5005); | 
|    86 // The addresses for the public turn server. |    86 // The addresses for the public turn server. | 
|    87 static const SocketAddress kTurnUdpIntAddr("99.99.99.4", |    87 static const SocketAddress kTurnUdpIntAddr("99.99.99.4", | 
|    88                                            cricket::STUN_SERVER_PORT); |    88                                            cricket::STUN_SERVER_PORT); | 
|    89 static const SocketAddress kTurnTcpIntAddr("99.99.99.4", |    89 static const SocketAddress kTurnTcpIntAddr("99.99.99.4", | 
|    90                                            cricket::STUN_SERVER_PORT + 1); |    90                                            cricket::STUN_SERVER_PORT + 1); | 
|    91 static const SocketAddress kTurnUdpExtAddr("99.99.99.5", 0); |    91 static const SocketAddress kTurnUdpExtAddr("99.99.99.5", 0); | 
|    92 static const cricket::RelayCredentials kRelayCredentials("test", "test"); |    92 static const cricket::RelayCredentials kRelayCredentials("test", "test"); | 
|    93  |    93  | 
|    94 // Based on ICE_UFRAG_LENGTH |    94 // Based on ICE_UFRAG_LENGTH | 
|    95 static const char* kIceUfrag[4] = {"UF00", "UF01", |    95 const char* kIceUfrag[4] = {"UF00", "UF01", "UF02", "UF03"}; | 
|    96                                    "UF02", "UF03"}; |  | 
|    97 // Based on ICE_PWD_LENGTH |    96 // Based on ICE_PWD_LENGTH | 
|    98 static const char* kIcePwd[4] = {"TESTICEPWD00000000000000", |    97 const char* kIcePwd[4] = { | 
|    99                                  "TESTICEPWD00000000000001", |    98     "TESTICEPWD00000000000000", "TESTICEPWD00000000000001", | 
|   100                                  "TESTICEPWD00000000000002", |    99     "TESTICEPWD00000000000002", "TESTICEPWD00000000000003"}; | 
|   101                                  "TESTICEPWD00000000000003"}; |   100 const cricket::IceParameters kIceParams[4] = { | 
 |   101     {kIceUfrag[0], kIcePwd[0], false}, | 
 |   102     {kIceUfrag[1], kIcePwd[1], false}, | 
 |   103     {kIceUfrag[2], kIcePwd[2], false}, | 
 |   104     {kIceUfrag[3], kIcePwd[3], false}}; | 
|   102  |   105  | 
|   103 static const uint64_t kLowTiebreaker = 11111; |   106 const uint64_t kLowTiebreaker = 11111; | 
|   104 static const uint64_t kHighTiebreaker = 22222; |   107 const uint64_t kHighTiebreaker = 22222; | 
|   105  |   108  | 
|   106 enum { MSG_ADD_CANDIDATES, MSG_REMOVE_CANDIDATES }; |   109 enum { MSG_ADD_CANDIDATES, MSG_REMOVE_CANDIDATES }; | 
|   107  |   110  | 
|   108 cricket::IceConfig CreateIceConfig( |   111 cricket::IceConfig CreateIceConfig( | 
|   109     int receiving_timeout, |   112     int receiving_timeout, | 
|   110     cricket::ContinualGatheringPolicy continual_gathering_policy, |   113     cricket::ContinualGatheringPolicy continual_gathering_policy, | 
|   111     int backup_ping_interval = -1) { |   114     int backup_ping_interval = -1) { | 
|   112   cricket::IceConfig config; |   115   cricket::IceConfig config; | 
|   113   config.receiving_timeout = receiving_timeout; |   116   config.receiving_timeout = receiving_timeout; | 
|   114   config.continual_gathering_policy = continual_gathering_policy; |   117   config.continual_gathering_policy = continual_gathering_policy; | 
|   115   config.backup_connection_ping_interval = backup_ping_interval; |   118   config.backup_connection_ping_interval = backup_ping_interval; | 
|   116   return config; |   119   return config; | 
|   117 } |   120 } | 
|   118  |   121  | 
|   119 cricket::Candidate CreateUdpCandidate(const std::string& type, |   122 cricket::Candidate CreateUdpCandidate(const std::string& type, | 
|   120                                       const std::string& ip, |   123                                       const std::string& ip, | 
|   121                                       int port, |   124                                       int port, | 
|   122                                       int priority, |   125                                       int priority, | 
|   123                                       const std::string& ufrag = "") { |   126                                       const std::string& ufrag = "") { | 
|   124   cricket::Candidate c; |   127   cricket::Candidate c; | 
|   125   c.set_address(rtc::SocketAddress(ip, port)); |   128   c.set_address(rtc::SocketAddress(ip, port)); | 
|   126   c.set_component(cricket::ICE_CANDIDATE_COMPONENT_DEFAULT); |   129   c.set_component(cricket::ICE_CANDIDATE_COMPONENT_DEFAULT); | 
|   127   c.set_protocol(cricket::UDP_PROTOCOL_NAME); |   130   c.set_protocol(cricket::UDP_PROTOCOL_NAME); | 
|   128   c.set_priority(priority); |   131   c.set_priority(priority); | 
|   129   c.set_username(ufrag); |   132   c.set_username(ufrag); | 
|   130   c.set_type(type); |   133   c.set_type(type); | 
|   131   return c; |   134   return c; | 
|   132 } |   135 } | 
|   133  |   136  | 
|   134 }  // namespace { |   137 }  // namespace | 
|   135  |   138  | 
|   136 namespace cricket { |   139 namespace cricket { | 
|   137  |   140  | 
|   138 // This test simulates 2 P2P endpoints that want to establish connectivity |   141 // This test simulates 2 P2P endpoints that want to establish connectivity | 
|   139 // with each other over various network topologies and conditions, which can be |   142 // with each other over various network topologies and conditions, which can be | 
|   140 // specified in each individial test. |   143 // specified in each individial test. | 
|   141 // A virtual network (via VirtualSocketServer) along with virtual firewalls and |   144 // A virtual network (via VirtualSocketServer) along with virtual firewalls and | 
|   142 // NATs (via Firewall/NATSocketServer) are used to simulate the various network |   145 // NATs (via Firewall/NATSocketServer) are used to simulate the various network | 
|   143 // conditions. We can configure the IP addresses of the endpoints, |   146 // conditions. We can configure the IP addresses of the endpoints, | 
|   144 // block various types of connectivity, or add arbitrary levels of NAT. |   147 // block various types of connectivity, or add arbitrary levels of NAT. | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   298   }; |   301   }; | 
|   299  |   302  | 
|   300   ChannelData* GetChannelData(TransportChannel* channel) { |   303   ChannelData* GetChannelData(TransportChannel* channel) { | 
|   301     if (ep1_.HasChannel(channel)) |   304     if (ep1_.HasChannel(channel)) | 
|   302       return ep1_.GetChannelData(channel); |   305       return ep1_.GetChannelData(channel); | 
|   303     else |   306     else | 
|   304       return ep2_.GetChannelData(channel); |   307       return ep2_.GetChannelData(channel); | 
|   305   } |   308   } | 
|   306  |   309  | 
|   307   void CreateChannels(int num) { |   310   void CreateChannels(int num) { | 
|   308     std::string ice_ufrag_ep1_cd1_ch = kIceUfrag[0]; |   311     const IceParameters& ice_ep1_cd1_ch = kIceParams[0]; | 
|   309     std::string ice_pwd_ep1_cd1_ch = kIcePwd[0]; |   312     const IceParameters& ice_ep2_cd1_ch = kIceParams[1]; | 
|   310     std::string ice_ufrag_ep2_cd1_ch = kIceUfrag[1]; |   313     ep1_.cd1_.ch_.reset(CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, | 
|   311     std::string ice_pwd_ep2_cd1_ch = kIcePwd[1]; |   314                                       ice_ep1_cd1_ch, ice_ep2_cd1_ch)); | 
|   312     ep1_.cd1_.ch_.reset(CreateChannel( |   315     ep2_.cd1_.ch_.reset(CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, | 
|   313         0, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep1_cd1_ch, |   316                                       ice_ep2_cd1_ch, ice_ep1_cd1_ch)); | 
|   314         ice_pwd_ep1_cd1_ch, ice_ufrag_ep2_cd1_ch, ice_pwd_ep2_cd1_ch)); |  | 
|   315     ep2_.cd1_.ch_.reset(CreateChannel( |  | 
|   316         1, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep2_cd1_ch, |  | 
|   317         ice_pwd_ep2_cd1_ch, ice_ufrag_ep1_cd1_ch, ice_pwd_ep1_cd1_ch)); |  | 
|   318     ep1_.cd1_.ch_->MaybeStartGathering(); |   317     ep1_.cd1_.ch_->MaybeStartGathering(); | 
|   319     ep2_.cd1_.ch_->MaybeStartGathering(); |   318     ep2_.cd1_.ch_->MaybeStartGathering(); | 
|   320     if (num == 2) { |   319     if (num == 2) { | 
|   321       std::string ice_ufrag_ep1_cd2_ch = kIceUfrag[2]; |   320       const IceParameters& ice_ep1_cd2_ch = kIceParams[2]; | 
|   322       std::string ice_pwd_ep1_cd2_ch = kIcePwd[2]; |   321       const IceParameters& ice_ep2_cd2_ch = kIceParams[3]; | 
|   323       std::string ice_ufrag_ep2_cd2_ch = kIceUfrag[3]; |   322       ep1_.cd2_.ch_.reset(CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, | 
|   324       std::string ice_pwd_ep2_cd2_ch = kIcePwd[3]; |   323                                         ice_ep1_cd2_ch, ice_ep2_cd2_ch)); | 
|   325       ep1_.cd2_.ch_.reset(CreateChannel( |   324       ep2_.cd2_.ch_.reset(CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, | 
|   326           0, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep1_cd2_ch, |   325                                         ice_ep2_cd2_ch, ice_ep1_cd2_ch)); | 
|   327           ice_pwd_ep1_cd2_ch, ice_ufrag_ep2_cd2_ch, ice_pwd_ep2_cd2_ch)); |  | 
|   328       ep2_.cd2_.ch_.reset(CreateChannel( |  | 
|   329           1, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep2_cd2_ch, |  | 
|   330           ice_pwd_ep2_cd2_ch, ice_ufrag_ep1_cd2_ch, ice_pwd_ep1_cd2_ch)); |  | 
|   331       ep1_.cd2_.ch_->MaybeStartGathering(); |   326       ep1_.cd2_.ch_->MaybeStartGathering(); | 
|   332       ep2_.cd2_.ch_->MaybeStartGathering(); |   327       ep2_.cd2_.ch_->MaybeStartGathering(); | 
|   333     } |   328     } | 
|   334   } |   329   } | 
|   335   P2PTransportChannel* CreateChannel(int endpoint, |   330   P2PTransportChannel* CreateChannel(int endpoint, | 
|   336                                      int component, |   331                                      int component, | 
|   337                                      const std::string& local_ice_ufrag, |   332                                      const IceParameters& local_ice, | 
|   338                                      const std::string& local_ice_pwd, |   333                                      const IceParameters& remote_ice) { | 
|   339                                      const std::string& remote_ice_ufrag, |  | 
|   340                                      const std::string& remote_ice_pwd) { |  | 
|   341     P2PTransportChannel* channel = new P2PTransportChannel( |   334     P2PTransportChannel* channel = new P2PTransportChannel( | 
|   342         "test content name", component, GetAllocator(endpoint)); |   335         "test content name", component, GetAllocator(endpoint)); | 
|   343     channel->SignalReadyToSend.connect( |   336     channel->SignalReadyToSend.connect( | 
|   344         this, &P2PTransportChannelTestBase::OnReadyToSend); |   337         this, &P2PTransportChannelTestBase::OnReadyToSend); | 
|   345     channel->SignalCandidateGathered.connect( |   338     channel->SignalCandidateGathered.connect( | 
|   346         this, &P2PTransportChannelTestBase::OnCandidateGathered); |   339         this, &P2PTransportChannelTestBase::OnCandidateGathered); | 
|   347     channel->SignalCandidatesRemoved.connect( |   340     channel->SignalCandidatesRemoved.connect( | 
|   348         this, &P2PTransportChannelTestBase::OnCandidatesRemoved); |   341         this, &P2PTransportChannelTestBase::OnCandidatesRemoved); | 
|   349     channel->SignalReadPacket.connect( |   342     channel->SignalReadPacket.connect( | 
|   350         this, &P2PTransportChannelTestBase::OnReadPacket); |   343         this, &P2PTransportChannelTestBase::OnReadPacket); | 
|   351     channel->SignalRoleConflict.connect( |   344     channel->SignalRoleConflict.connect( | 
|   352         this, &P2PTransportChannelTestBase::OnRoleConflict); |   345         this, &P2PTransportChannelTestBase::OnRoleConflict); | 
|   353     channel->SignalSelectedCandidatePairChanged.connect( |   346     channel->SignalSelectedCandidatePairChanged.connect( | 
|   354         this, &P2PTransportChannelTestBase::OnSelectedCandidatePairChanged); |   347         this, &P2PTransportChannelTestBase::OnSelectedCandidatePairChanged); | 
|   355     channel->SetIceCredentials(local_ice_ufrag, local_ice_pwd); |   348     channel->SetIceParameters(local_ice); | 
|   356     if (remote_ice_credential_source_ == FROM_SETICECREDENTIALS) { |   349     if (remote_ice_parameter_source_ == FROM_SETICEPARAMETERS) { | 
|   357       channel->SetRemoteIceCredentials(remote_ice_ufrag, remote_ice_pwd); |   350       channel->SetRemoteIceParameters(remote_ice); | 
|   358     } |   351     } | 
|   359     channel->SetIceRole(GetEndpoint(endpoint)->ice_role()); |   352     channel->SetIceRole(GetEndpoint(endpoint)->ice_role()); | 
|   360     channel->SetIceTiebreaker(GetEndpoint(endpoint)->GetIceTiebreaker()); |   353     channel->SetIceTiebreaker(GetEndpoint(endpoint)->GetIceTiebreaker()); | 
|   361     return channel; |   354     return channel; | 
|   362   } |   355   } | 
|   363   void DestroyChannels() { |   356   void DestroyChannels() { | 
|   364     ep1_.cd1_.ch_.reset(); |   357     ep1_.cd1_.ch_.reset(); | 
|   365     ep2_.cd1_.ch_.reset(); |   358     ep2_.cd1_.ch_.reset(); | 
|   366     ep1_.cd2_.ch_.reset(); |   359     ep1_.cd2_.ch_.reset(); | 
|   367     ep2_.cd2_.ch_.reset(); |   360     ep2_.cd2_.ch_.reset(); | 
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   601         // local_channel2 <==> remote_channel2 |   594         // local_channel2 <==> remote_channel2 | 
|   602         EXPECT_EQ_WAIT(len, SendData(ep1_ch2(), data, len), 1000); |   595         EXPECT_EQ_WAIT(len, SendData(ep1_ch2(), data, len), 1000); | 
|   603         EXPECT_TRUE_WAIT(CheckDataOnChannel(ep2_ch2(), data, len), 1000); |   596         EXPECT_TRUE_WAIT(CheckDataOnChannel(ep2_ch2(), data, len), 1000); | 
|   604         EXPECT_EQ_WAIT(len, SendData(ep2_ch2(), data, len), 1000); |   597         EXPECT_EQ_WAIT(len, SendData(ep2_ch2(), data, len), 1000); | 
|   605         EXPECT_TRUE_WAIT(CheckDataOnChannel(ep1_ch2(), data, len), 1000); |   598         EXPECT_TRUE_WAIT(CheckDataOnChannel(ep1_ch2(), data, len), 1000); | 
|   606       } |   599       } | 
|   607     } |   600     } | 
|   608   } |   601   } | 
|   609  |   602  | 
|   610   // This test waits for the transport to become receiving and writable on both |   603   // This test waits for the transport to become receiving and writable on both | 
|   611   // end points. Once they are, the end points set new local ice credentials and |   604   // end points. Once they are, the end points set new local ice parameters and | 
|   612   // restart the ice gathering. Finally it waits for the transport to select a |   605   // restart the ice gathering. Finally it waits for the transport to select a | 
|   613   // new connection using the newly generated ice candidates. |   606   // new connection using the newly generated ice candidates. | 
|   614   // Before calling this function the end points must be configured. |   607   // Before calling this function the end points must be configured. | 
|   615   void TestHandleIceUfragPasswordChanged() { |   608   void TestHandleIceUfragPasswordChanged() { | 
|   616     ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |   609     ep1_ch1()->SetRemoteIceParameters(kIceParams[1]); | 
|   617     ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]); |   610     ep2_ch1()->SetRemoteIceParameters(kIceParams[0]); | 
|   618     EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && |   611     EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 
|   619                             ep2_ch1()->receiving() && ep2_ch1()->writable(), |   612                             ep2_ch1()->receiving() && ep2_ch1()->writable(), | 
|   620                             1000, 1000); |   613                             1000, 1000); | 
|   621  |   614  | 
|   622     const Candidate* old_local_candidate1 = LocalCandidate(ep1_ch1()); |   615     const Candidate* old_local_candidate1 = LocalCandidate(ep1_ch1()); | 
|   623     const Candidate* old_local_candidate2 = LocalCandidate(ep2_ch1()); |   616     const Candidate* old_local_candidate2 = LocalCandidate(ep2_ch1()); | 
|   624     const Candidate* old_remote_candidate1 = RemoteCandidate(ep1_ch1()); |   617     const Candidate* old_remote_candidate1 = RemoteCandidate(ep1_ch1()); | 
|   625     const Candidate* old_remote_candidate2 = RemoteCandidate(ep2_ch1()); |   618     const Candidate* old_remote_candidate2 = RemoteCandidate(ep2_ch1()); | 
|   626  |   619  | 
|   627     ep1_ch1()->SetIceCredentials(kIceUfrag[2], kIcePwd[2]); |   620     ep1_ch1()->SetIceParameters(kIceParams[2]); | 
|   628     ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |   621     ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); | 
|   629     ep1_ch1()->MaybeStartGathering(); |   622     ep1_ch1()->MaybeStartGathering(); | 
|   630     ep2_ch1()->SetIceCredentials(kIceUfrag[3], kIcePwd[3]); |   623     ep2_ch1()->SetIceParameters(kIceParams[3]); | 
|   631     ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]); |   624  | 
 |   625     ep2_ch1()->SetRemoteIceParameters(kIceParams[2]); | 
|   632     ep2_ch1()->MaybeStartGathering(); |   626     ep2_ch1()->MaybeStartGathering(); | 
|   633  |   627  | 
|   634     EXPECT_TRUE_WAIT_MARGIN(LocalCandidate(ep1_ch1())->generation() != |   628     EXPECT_TRUE_WAIT_MARGIN(LocalCandidate(ep1_ch1())->generation() != | 
|   635                             old_local_candidate1->generation(), |   629                             old_local_candidate1->generation(), | 
|   636                             1000, 1000); |   630                             1000, 1000); | 
|   637     EXPECT_TRUE_WAIT_MARGIN(LocalCandidate(ep2_ch1())->generation() != |   631     EXPECT_TRUE_WAIT_MARGIN(LocalCandidate(ep2_ch1())->generation() != | 
|   638                             old_local_candidate2->generation(), |   632                             old_local_candidate2->generation(), | 
|   639                             1000, 1000); |   633                             1000, 1000); | 
|   640     EXPECT_TRUE_WAIT_MARGIN(RemoteCandidate(ep1_ch1())->generation() != |   634     EXPECT_TRUE_WAIT_MARGIN(RemoteCandidate(ep1_ch1())->generation() != | 
|   641                             old_remote_candidate1->generation(), |   635                             old_remote_candidate1->generation(), | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   744   void OnMessage(rtc::Message* msg) { |   738   void OnMessage(rtc::Message* msg) { | 
|   745     switch (msg->message_id) { |   739     switch (msg->message_id) { | 
|   746       case MSG_ADD_CANDIDATES: { |   740       case MSG_ADD_CANDIDATES: { | 
|   747         std::unique_ptr<CandidatesData> data( |   741         std::unique_ptr<CandidatesData> data( | 
|   748             static_cast<CandidatesData*>(msg->pdata)); |   742             static_cast<CandidatesData*>(msg->pdata)); | 
|   749         P2PTransportChannel* rch = GetRemoteChannel(data->channel); |   743         P2PTransportChannel* rch = GetRemoteChannel(data->channel); | 
|   750         if (!rch) { |   744         if (!rch) { | 
|   751           return; |   745           return; | 
|   752         } |   746         } | 
|   753         for (auto& c : data->candidates) { |   747         for (auto& c : data->candidates) { | 
|   754           if (remote_ice_credential_source_ != FROM_CANDIDATE) { |   748           if (remote_ice_parameter_source_ != FROM_CANDIDATE) { | 
|   755             c.set_username(""); |   749             c.set_username(""); | 
|   756             c.set_password(""); |   750             c.set_password(""); | 
|   757           } |   751           } | 
|   758           LOG(LS_INFO) << "Candidate(" << data->channel->component() << "->" |   752           LOG(LS_INFO) << "Candidate(" << data->channel->component() << "->" | 
|   759                        << rch->component() << "): " << c.ToString(); |   753                        << rch->component() << "): " << c.ToString(); | 
|   760           rch->AddRemoteCandidate(c); |   754           rch->AddRemoteCandidate(c); | 
|   761         } |   755         } | 
|   762         break; |   756         break; | 
|   763       } |   757       } | 
|   764       case MSG_REMOVE_CANDIDATES: { |   758       case MSG_REMOVE_CANDIDATES: { | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   829       return ep1_ch1(); |   823       return ep1_ch1(); | 
|   830     else if (ch == ep2_ch2()) |   824     else if (ch == ep2_ch2()) | 
|   831       return ep1_ch2(); |   825       return ep1_ch2(); | 
|   832     else |   826     else | 
|   833       return NULL; |   827       return NULL; | 
|   834   } |   828   } | 
|   835   std::list<std::string>& GetPacketList(TransportChannel* ch) { |   829   std::list<std::string>& GetPacketList(TransportChannel* ch) { | 
|   836     return GetChannelData(ch)->ch_packets_; |   830     return GetChannelData(ch)->ch_packets_; | 
|   837   } |   831   } | 
|   838  |   832  | 
|   839   enum RemoteIceCredentialSource { FROM_CANDIDATE, FROM_SETICECREDENTIALS }; |   833   enum RemoteIceParameterSource { FROM_CANDIDATE, FROM_SETICEPARAMETERS }; | 
|   840  |   834  | 
|   841   // How does the test pass ICE credentials to the P2PTransportChannel? |   835   // How does the test pass ICE parameters to the P2PTransportChannel? | 
|   842   // On the candidate itself, or through SetIceCredentials? |   836   // On the candidate itself, or through SetRemoteIceParameters? | 
|   843   // Goes through the candidate itself by default. |   837   // Goes through the candidate itself by default. | 
|   844   void set_remote_ice_credential_source(RemoteIceCredentialSource source) { |   838   void set_remote_ice_parameter_source(RemoteIceParameterSource source) { | 
|   845     remote_ice_credential_source_ = source; |   839     remote_ice_parameter_source_ = source; | 
|   846   } |   840   } | 
|   847  |   841  | 
|   848   void set_force_relay(bool relay) { |   842   void set_force_relay(bool relay) { | 
|   849     force_relay_ = relay; |   843     force_relay_ = relay; | 
|   850   } |   844   } | 
|   851  |   845  | 
|   852   void ConnectSignalNominated(Connection* conn) { |   846   void ConnectSignalNominated(Connection* conn) { | 
|   853     conn->SignalNominated.connect(this, |   847     conn->SignalNominated.connect(this, | 
|   854                                   &P2PTransportChannelTestBase::OnNominated); |   848                                   &P2PTransportChannelTestBase::OnNominated); | 
|   855   } |   849   } | 
|   856  |   850  | 
|   857   void OnNominated(Connection* conn) { nominated_ = true; } |   851   void OnNominated(Connection* conn) { nominated_ = true; } | 
|   858   bool nominated() { return nominated_; } |   852   bool nominated() { return nominated_; } | 
|   859  |   853  | 
 |   854   bool SetIceRenomination(P2PTransportChannel* channel, bool renomination) { | 
 |   855     IceParameters* remote_ice = channel->remote_ice(); | 
 |   856     if (!remote_ice) { | 
 |   857       return false; | 
 |   858     } | 
 |   859     remote_ice->renomination = renomination; | 
 |   860     IceParameters ice_params = channel->ice_parameters(); | 
 |   861     ice_params.renomination = renomination; | 
 |   862     channel->SetIceParameters(ice_params); | 
 |   863     return true; | 
 |   864   } | 
 |   865  | 
|   860  private: |   866  private: | 
|   861   rtc::Thread* main_; |   867   rtc::Thread* main_; | 
|   862   std::unique_ptr<rtc::PhysicalSocketServer> pss_; |   868   std::unique_ptr<rtc::PhysicalSocketServer> pss_; | 
|   863   std::unique_ptr<rtc::VirtualSocketServer> vss_; |   869   std::unique_ptr<rtc::VirtualSocketServer> vss_; | 
|   864   std::unique_ptr<rtc::NATSocketServer> nss_; |   870   std::unique_ptr<rtc::NATSocketServer> nss_; | 
|   865   std::unique_ptr<rtc::FirewallSocketServer> ss_; |   871   std::unique_ptr<rtc::FirewallSocketServer> ss_; | 
|   866   rtc::SocketServerScope ss_scope_; |   872   rtc::SocketServerScope ss_scope_; | 
|   867   std::unique_ptr<TestStunServer> stun_server_; |   873   std::unique_ptr<TestStunServer> stun_server_; | 
|   868   TestTurnServer turn_server_; |   874   TestTurnServer turn_server_; | 
|   869   TestRelayServer relay_server_; |   875   TestRelayServer relay_server_; | 
|   870   rtc::SocksProxyServer socks_server1_; |   876   rtc::SocksProxyServer socks_server1_; | 
|   871   rtc::SocksProxyServer socks_server2_; |   877   rtc::SocksProxyServer socks_server2_; | 
|   872   Endpoint ep1_; |   878   Endpoint ep1_; | 
|   873   Endpoint ep2_; |   879   Endpoint ep2_; | 
|   874   RemoteIceCredentialSource remote_ice_credential_source_ = FROM_CANDIDATE; |   880   RemoteIceParameterSource remote_ice_parameter_source_ = FROM_CANDIDATE; | 
|   875   bool force_relay_; |   881   bool force_relay_; | 
|   876   int selected_candidate_pair_switches_ = 0; |   882   int selected_candidate_pair_switches_ = 0; | 
|   877  |   883  | 
|   878   bool nominated_ = false; |   884   bool nominated_ = false; | 
|   879 }; |   885 }; | 
|   880  |   886  | 
|   881 // The tests have only a few outcomes, which we predefine. |   887 // The tests have only a few outcomes, which we predefine. | 
|   882 const P2PTransportChannelTestBase::Result P2PTransportChannelTestBase:: |   888 const P2PTransportChannelTestBase::Result P2PTransportChannelTestBase:: | 
|   883     kLocalUdpToLocalUdp("local", "udp", "local", "udp", |   889     kLocalUdpToLocalUdp("local", "udp", "local", "udp", | 
|   884                         "local", "udp", "local", "udp", 1000); |   890                         "local", "udp", "local", "udp", 1000); | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   942     GetEndpoint(1)->allocator_->AddTurnServer(turn_server); |   948     GetEndpoint(1)->allocator_->AddTurnServer(turn_server); | 
|   943  |   949  | 
|   944     int delay = kMinimumStepDelay; |   950     int delay = kMinimumStepDelay; | 
|   945     ConfigureEndpoint(0, config1); |   951     ConfigureEndpoint(0, config1); | 
|   946     SetAllocatorFlags(0, allocator_flags1); |   952     SetAllocatorFlags(0, allocator_flags1); | 
|   947     SetAllocationStepDelay(0, delay); |   953     SetAllocationStepDelay(0, delay); | 
|   948     ConfigureEndpoint(1, config2); |   954     ConfigureEndpoint(1, config2); | 
|   949     SetAllocatorFlags(1, allocator_flags2); |   955     SetAllocatorFlags(1, allocator_flags2); | 
|   950     SetAllocationStepDelay(1, delay); |   956     SetAllocationStepDelay(1, delay); | 
|   951  |   957  | 
|   952     set_remote_ice_credential_source(FROM_SETICECREDENTIALS); |   958     set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 
|   953   } |   959   } | 
|   954   void ConfigureEndpoint(int endpoint, Config config) { |   960   void ConfigureEndpoint(int endpoint, Config config) { | 
|   955     switch (config) { |   961     switch (config) { | 
|   956       case OPEN: |   962       case OPEN: | 
|   957         AddAddress(endpoint, kPublicAddrs[endpoint]); |   963         AddAddress(endpoint, kPublicAddrs[endpoint]); | 
|   958         break; |   964         break; | 
|   959       case NAT_FULL_CONE: |   965       case NAT_FULL_CONE: | 
|   960       case NAT_ADDR_RESTRICTED: |   966       case NAT_ADDR_RESTRICTED: | 
|   961       case NAT_PORT_RESTRICTED: |   967       case NAT_PORT_RESTRICTED: | 
|   962       case NAT_SYMMETRIC: |   968       case NAT_SYMMETRIC: | 
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1155   EXPECT_EQ(10 * 36U, best_conn_info->recv_total_bytes); |  1161   EXPECT_EQ(10 * 36U, best_conn_info->recv_total_bytes); | 
|  1156   EXPECT_GT(best_conn_info->rtt, 0U); |  1162   EXPECT_GT(best_conn_info->rtt, 0U); | 
|  1157   DestroyChannels(); |  1163   DestroyChannels(); | 
|  1158 } |  1164 } | 
|  1159  |  1165  | 
|  1160 // Test that we properly create a connection on a STUN ping from unknown address |  1166 // Test that we properly create a connection on a STUN ping from unknown address | 
|  1161 // when the signaling is slow. |  1167 // when the signaling is slow. | 
|  1162 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { |  1168 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { | 
|  1163   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |  1169   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 
|  1164                      kDefaultPortAllocatorFlags); |  1170                      kDefaultPortAllocatorFlags); | 
|  1165   // Emulate no remote credentials coming in. |  1171   // Emulate no remote parameters coming in. | 
|  1166   set_remote_ice_credential_source(FROM_CANDIDATE); |  1172   set_remote_ice_parameter_source(FROM_CANDIDATE); | 
|  1167   CreateChannels(1); |  1173   CreateChannels(1); | 
|  1168   // Only have remote credentials come in for ep2, not ep1. |  1174   // Only have remote parameters come in for ep2, not ep1. | 
|  1169   ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]); |  1175   ep2_ch1()->SetRemoteIceParameters(kIceParams[0]); | 
|  1170  |  1176  | 
|  1171   // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive |  1177   // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive | 
|  1172   // candidate. |  1178   // candidate. | 
|  1173   PauseCandidates(1); |  1179   PauseCandidates(1); | 
|  1174  |  1180  | 
|  1175   // The caller should have the selected connection connected to the peer |  1181   // The caller should have the selected connection connected to the peer | 
|  1176   // reflexive candidate. |  1182   // reflexive candidate. | 
|  1177   const Connection* selected_connection = NULL; |  1183   const Connection* selected_connection = NULL; | 
|  1178   WAIT((selected_connection = ep1_ch1()->selected_connection()) != NULL, 2000); |  1184   WAIT((selected_connection = ep1_ch1()->selected_connection()) != NULL, 2000); | 
|  1179   EXPECT_EQ("prflx", |  1185   EXPECT_EQ("prflx", | 
|  1180             ep1_ch1()->selected_connection()->remote_candidate().type()); |  1186             ep1_ch1()->selected_connection()->remote_candidate().type()); | 
|  1181  |  1187  | 
|  1182   // Because we don't have a remote pwd, we don't ping yet. |  1188   // Because we don't have a remote pwd, we don't ping yet. | 
|  1183   EXPECT_EQ(kIceUfrag[1], |  1189   EXPECT_EQ(kIceUfrag[1], | 
|  1184             ep1_ch1()->selected_connection()->remote_candidate().username()); |  1190             ep1_ch1()->selected_connection()->remote_candidate().username()); | 
|  1185   EXPECT_EQ("", |  1191   EXPECT_EQ("", | 
|  1186             ep1_ch1()->selected_connection()->remote_candidate().password()); |  1192             ep1_ch1()->selected_connection()->remote_candidate().password()); | 
|  1187   // Because we don't have ICE credentials yet, we don't know the generation. |  1193   // Because we don't have ICE parameters yet, we don't know the generation. | 
|  1188   EXPECT_EQ(0u, |  1194   EXPECT_EQ(0u, | 
|  1189             ep1_ch1()->selected_connection()->remote_candidate().generation()); |  1195             ep1_ch1()->selected_connection()->remote_candidate().generation()); | 
|  1190   EXPECT_TRUE(nullptr == ep1_ch1()->FindNextPingableConnection()); |  1196   EXPECT_TRUE(nullptr == ep1_ch1()->FindNextPingableConnection()); | 
|  1191  |  1197  | 
|  1192   // Add two sets of remote ICE credentials, so that the ones used by the |  1198   // Add two sets of remote ICE parameters, so that the ones used by the | 
|  1193   // candidate will be generation 1 instead of 0. |  1199   // candidate will be generation 1 instead of 0. | 
|  1194   ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |  1200   ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); | 
|  1195   ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |  1201   ep1_ch1()->SetRemoteIceParameters(kIceParams[1]); | 
|  1196   // After setting the remote ICE credentials, the password and generation |  1202  | 
 |  1203   // After setting the remote ICE parameters, the password and generation | 
|  1197   // of the peer reflexive candidate should be updated. |  1204   // of the peer reflexive candidate should be updated. | 
|  1198   EXPECT_EQ(kIcePwd[1], |  1205   EXPECT_EQ(kIcePwd[1], | 
|  1199             ep1_ch1()->selected_connection()->remote_candidate().password()); |  1206             ep1_ch1()->selected_connection()->remote_candidate().password()); | 
|  1200   EXPECT_EQ(1u, |  1207   EXPECT_EQ(1u, | 
|  1201             ep1_ch1()->selected_connection()->remote_candidate().generation()); |  1208             ep1_ch1()->selected_connection()->remote_candidate().generation()); | 
|  1202   EXPECT_TRUE(nullptr != ep1_ch1()->FindNextPingableConnection()); |  1209   EXPECT_TRUE(nullptr != ep1_ch1()->FindNextPingableConnection()); | 
|  1203  |  1210  | 
|  1204   ResumeCandidates(1); |  1211   ResumeCandidates(1); | 
|  1205  |  1212  | 
|  1206   WAIT(ep2_ch1()->selected_connection() != NULL, 2000); |  1213   WAIT(ep2_ch1()->selected_connection() != NULL, 2000); | 
|  1207   // Verify ep1's selected connection is updated to use the 'local' candidate. |  1214   // Verify ep1's selected connection is updated to use the 'local' candidate. | 
|  1208   EXPECT_EQ_WAIT("local", |  1215   EXPECT_EQ_WAIT("local", | 
|  1209                  ep1_ch1()->selected_connection()->remote_candidate().type(), |  1216                  ep1_ch1()->selected_connection()->remote_candidate().type(), | 
|  1210                  2000); |  1217                  2000); | 
|  1211   EXPECT_EQ(selected_connection, ep1_ch1()->selected_connection()); |  1218   EXPECT_EQ(selected_connection, ep1_ch1()->selected_connection()); | 
|  1212   DestroyChannels(); |  1219   DestroyChannels(); | 
|  1213 } |  1220 } | 
|  1214  |  1221  | 
|  1215 // Test that we properly create a connection on a STUN ping from unknown address |  1222 // Test that we properly create a connection on a STUN ping from unknown address | 
|  1216 // when the signaling is slow and the end points are behind NAT. |  1223 // when the signaling is slow and the end points are behind NAT. | 
|  1217 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignalingWithNAT) { |  1224 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignalingWithNAT) { | 
|  1218   ConfigureEndpoints(OPEN, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, |  1225   ConfigureEndpoints(OPEN, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, | 
|  1219                      kDefaultPortAllocatorFlags); |  1226                      kDefaultPortAllocatorFlags); | 
|  1220   // Emulate no remote credentials coming in. |  1227   // Emulate no remote parameters coming in. | 
|  1221   set_remote_ice_credential_source(FROM_CANDIDATE); |  1228   set_remote_ice_parameter_source(FROM_CANDIDATE); | 
|  1222   CreateChannels(1); |  1229   CreateChannels(1); | 
|  1223   // Only have remote credentials come in for ep2, not ep1. |  1230   // Only have remote parameters come in for ep2, not ep1. | 
|  1224   ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]); |  1231   ep2_ch1()->SetRemoteIceParameters(kIceParams[0]); | 
|  1225   // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive |  1232   // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive | 
|  1226   // candidate. |  1233   // candidate. | 
|  1227   PauseCandidates(1); |  1234   PauseCandidates(1); | 
|  1228  |  1235  | 
|  1229   // The caller should have the selected connection connected to the peer |  1236   // The caller should have the selected connection connected to the peer | 
|  1230   // reflexive candidate. |  1237   // reflexive candidate. | 
|  1231   WAIT(ep1_ch1()->selected_connection() != NULL, 2000); |  1238   WAIT(ep1_ch1()->selected_connection() != NULL, 2000); | 
|  1232   EXPECT_EQ("prflx", |  1239   EXPECT_EQ("prflx", | 
|  1233             ep1_ch1()->selected_connection()->remote_candidate().type()); |  1240             ep1_ch1()->selected_connection()->remote_candidate().type()); | 
|  1234  |  1241  | 
|  1235   // Because we don't have a remote pwd, we don't ping yet. |  1242   // Because we don't have a remote pwd, we don't ping yet. | 
|  1236   EXPECT_EQ(kIceUfrag[1], |  1243   EXPECT_EQ(kIceUfrag[1], | 
|  1237             ep1_ch1()->selected_connection()->remote_candidate().username()); |  1244             ep1_ch1()->selected_connection()->remote_candidate().username()); | 
|  1238   EXPECT_EQ("", |  1245   EXPECT_EQ("", | 
|  1239             ep1_ch1()->selected_connection()->remote_candidate().password()); |  1246             ep1_ch1()->selected_connection()->remote_candidate().password()); | 
|  1240   // Because we don't have ICE credentials yet, we don't know the generation. |  1247   // Because we don't have ICE parameters yet, we don't know the generation. | 
|  1241   EXPECT_EQ(0u, |  1248   EXPECT_EQ(0u, | 
|  1242             ep1_ch1()->selected_connection()->remote_candidate().generation()); |  1249             ep1_ch1()->selected_connection()->remote_candidate().generation()); | 
|  1243   EXPECT_TRUE(nullptr == ep1_ch1()->FindNextPingableConnection()); |  1250   EXPECT_TRUE(nullptr == ep1_ch1()->FindNextPingableConnection()); | 
|  1244  |  1251  | 
|  1245   // Add two sets of remote ICE credentials, so that the ones used by the |  1252   // Add two sets of remote ICE parameters, so that the ones used by the | 
|  1246   // candidate will be generation 1 instead of 0. |  1253   // candidate will be generation 1 instead of 0. | 
|  1247   ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |  1254   ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); | 
|  1248   ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |  1255   ep1_ch1()->SetRemoteIceParameters(kIceParams[1]); | 
|  1249   // After setting the remote ICE credentials, the password and generation |  1256   // After setting the remote ICE parameters, the password and generation | 
|  1250   // of the peer reflexive candidate should be updated. |  1257   // of the peer reflexive candidate should be updated. | 
|  1251   EXPECT_EQ(kIcePwd[1], |  1258   EXPECT_EQ(kIcePwd[1], | 
|  1252             ep1_ch1()->selected_connection()->remote_candidate().password()); |  1259             ep1_ch1()->selected_connection()->remote_candidate().password()); | 
|  1253   EXPECT_EQ(1u, |  1260   EXPECT_EQ(1u, | 
|  1254             ep1_ch1()->selected_connection()->remote_candidate().generation()); |  1261             ep1_ch1()->selected_connection()->remote_candidate().generation()); | 
|  1255  |  1262  | 
|  1256   ResumeCandidates(1); |  1263   ResumeCandidates(1); | 
|  1257  |  1264  | 
|  1258   const Connection* selected_connection = NULL; |  1265   const Connection* selected_connection = NULL; | 
|  1259   WAIT((selected_connection = ep2_ch1()->selected_connection()) != NULL, 2000); |  1266   WAIT((selected_connection = ep2_ch1()->selected_connection()) != NULL, 2000); | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  1276 // generations. This resulted in the old-generation prflx candidate being |  1283 // generations. This resulted in the old-generation prflx candidate being | 
|  1277 // prioritized above new-generation candidate pairs. |  1284 // prioritized above new-generation candidate pairs. | 
|  1278 TEST_F(P2PTransportChannelTest, |  1285 TEST_F(P2PTransportChannelTest, | 
|  1279        PeerReflexiveCandidateBeforeSignalingWithIceRestart) { |  1286        PeerReflexiveCandidateBeforeSignalingWithIceRestart) { | 
|  1280   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |  1287   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 
|  1281                      kDefaultPortAllocatorFlags); |  1288                      kDefaultPortAllocatorFlags); | 
|  1282   // Only gather relay candidates, so that when the prflx candidate arrives |  1289   // Only gather relay candidates, so that when the prflx candidate arrives | 
|  1283   // it's prioritized above the current candidate pair. |  1290   // it's prioritized above the current candidate pair. | 
|  1284   GetEndpoint(0)->allocator_->set_candidate_filter(CF_RELAY); |  1291   GetEndpoint(0)->allocator_->set_candidate_filter(CF_RELAY); | 
|  1285   GetEndpoint(1)->allocator_->set_candidate_filter(CF_RELAY); |  1292   GetEndpoint(1)->allocator_->set_candidate_filter(CF_RELAY); | 
|  1286   // Setting this allows us to control when SetRemoteIceCredentials is called. |  1293   // Setting this allows us to control when SetRemoteIceParameters is called. | 
|  1287   set_remote_ice_credential_source(FROM_CANDIDATE); |  1294   set_remote_ice_parameter_source(FROM_CANDIDATE); | 
|  1288   CreateChannels(1); |  1295   CreateChannels(1); | 
|  1289   // Wait for the initial connection to be made. |  1296   // Wait for the initial connection to be made. | 
|  1290   ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |  1297   ep1_ch1()->SetRemoteIceParameters(kIceParams[1]); | 
|  1291   ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]); |  1298   ep2_ch1()->SetRemoteIceParameters(kIceParams[0]); | 
|  1292   EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |  1299   EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 
|  1293                        ep2_ch1()->receiving() && ep2_ch1()->writable(), |  1300                        ep2_ch1()->receiving() && ep2_ch1()->writable(), | 
|  1294                    kDefaultTimeout); |  1301                    kDefaultTimeout); | 
|  1295  |  1302  | 
|  1296   // Simulate an ICE restart on ep2, but don't signal the candidate or new |  1303   // Simulate an ICE restart on ep2, but don't signal the candidate or new | 
|  1297   // ICE credentials until after a prflx connection has been made. |  1304   // ICE parameters until after a prflx connection has been made. | 
|  1298   PauseCandidates(1); |  1305   PauseCandidates(1); | 
|  1299   ep2_ch1()->SetIceCredentials(kIceUfrag[3], kIcePwd[3]); |  1306   ep2_ch1()->SetIceParameters(kIceParams[3]); | 
|  1300   ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |  1307  | 
 |  1308   ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); | 
|  1301   ep2_ch1()->MaybeStartGathering(); |  1309   ep2_ch1()->MaybeStartGathering(); | 
|  1302  |  1310  | 
|  1303   // The caller should have the selected connection connected to the peer |  1311   // The caller should have the selected connection connected to the peer | 
|  1304   // reflexive candidate. |  1312   // reflexive candidate. | 
|  1305   EXPECT_EQ_WAIT("prflx", |  1313   EXPECT_EQ_WAIT("prflx", | 
|  1306                  ep1_ch1()->selected_connection()->remote_candidate().type(), |  1314                  ep1_ch1()->selected_connection()->remote_candidate().type(), | 
|  1307                  kDefaultTimeout); |  1315                  kDefaultTimeout); | 
|  1308   const Connection* prflx_selected_connection = |  1316   const Connection* prflx_selected_connection = | 
|  1309       ep1_ch1()->selected_connection(); |  1317       ep1_ch1()->selected_connection(); | 
|  1310  |  1318  | 
|  1311   // Now simulate the ICE restart on ep1. |  1319   // Now simulate the ICE restart on ep1. | 
|  1312   ep1_ch1()->SetIceCredentials(kIceUfrag[2], kIcePwd[2]); |  1320   ep1_ch1()->SetIceParameters(kIceParams[2]); | 
|  1313   ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]); |  1321  | 
 |  1322   ep2_ch1()->SetRemoteIceParameters(kIceParams[2]); | 
|  1314   ep1_ch1()->MaybeStartGathering(); |  1323   ep1_ch1()->MaybeStartGathering(); | 
|  1315  |  1324  | 
|  1316   // Finally send the candidates from ep2's ICE restart and verify that ep1 uses |  1325   // Finally send the candidates from ep2's ICE restart and verify that ep1 uses | 
|  1317   // their information to update the peer reflexive candidate. |  1326   // their information to update the peer reflexive candidate. | 
|  1318   ResumeCandidates(1); |  1327   ResumeCandidates(1); | 
|  1319  |  1328  | 
|  1320   EXPECT_EQ_WAIT("relay", |  1329   EXPECT_EQ_WAIT("relay", | 
|  1321                  ep1_ch1()->selected_connection()->remote_candidate().type(), |  1330                  ep1_ch1()->selected_connection()->remote_candidate().type(), | 
|  1322                  kDefaultTimeout); |  1331                  kDefaultTimeout); | 
|  1323   EXPECT_EQ(prflx_selected_connection, ep1_ch1()->selected_connection()); |  1332   EXPECT_EQ(prflx_selected_connection, ep1_ch1()->selected_connection()); | 
|  1324   DestroyChannels(); |  1333   DestroyChannels(); | 
|  1325 } |  1334 } | 
|  1326  |  1335  | 
|  1327 // Test that if remote candidates don't have ufrag and pwd, we still work. |  1336 // Test that if remote candidates don't have ufrag and pwd, we still work. | 
|  1328 TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) { |  1337 TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) { | 
|  1329   set_remote_ice_credential_source(FROM_SETICECREDENTIALS); |  1338   set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 
|  1330   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |  1339   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 
|  1331                      kDefaultPortAllocatorFlags); |  1340                      kDefaultPortAllocatorFlags); | 
|  1332   CreateChannels(1); |  1341   CreateChannels(1); | 
|  1333   const Connection* selected_connection = NULL; |  1342   const Connection* selected_connection = NULL; | 
|  1334   // Wait until the callee's connections are created. |  1343   // Wait until the callee's connections are created. | 
|  1335   WAIT((selected_connection = ep2_ch1()->selected_connection()) != NULL, 1000); |  1344   WAIT((selected_connection = ep2_ch1()->selected_connection()) != NULL, 1000); | 
|  1336   // Wait to see if they get culled; they shouldn't. |  1345   // Wait to see if they get culled; they shouldn't. | 
|  1337   WAIT(ep2_ch1()->selected_connection() != selected_connection, 1000); |  1346   WAIT(ep2_ch1()->selected_connection() != selected_connection, 1000); | 
|  1338   EXPECT_TRUE(ep2_ch1()->selected_connection() == selected_connection); |  1347   EXPECT_TRUE(ep2_ch1()->selected_connection() == selected_connection); | 
|  1339   DestroyChannels(); |  1348   DestroyChannels(); | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1388   int kOnlyLocalTcpPorts = PORTALLOCATOR_DISABLE_UDP | |  1397   int kOnlyLocalTcpPorts = PORTALLOCATOR_DISABLE_UDP | | 
|  1389                            PORTALLOCATOR_DISABLE_STUN | |  1398                            PORTALLOCATOR_DISABLE_STUN | | 
|  1390                            PORTALLOCATOR_DISABLE_RELAY; |  1399                            PORTALLOCATOR_DISABLE_RELAY; | 
|  1391   // Disable all protocols except TCP. |  1400   // Disable all protocols except TCP. | 
|  1392   SetAllocatorFlags(0, kOnlyLocalTcpPorts); |  1401   SetAllocatorFlags(0, kOnlyLocalTcpPorts); | 
|  1393   SetAllocatorFlags(1, kOnlyLocalTcpPorts); |  1402   SetAllocatorFlags(1, kOnlyLocalTcpPorts); | 
|  1394  |  1403  | 
|  1395   SetAllowTcpListen(0, true);   // actpass. |  1404   SetAllowTcpListen(0, true);   // actpass. | 
|  1396   SetAllowTcpListen(1, false);  // active. |  1405   SetAllowTcpListen(1, false);  // active. | 
|  1397  |  1406  | 
|  1398   // We want SetRemoteIceCredentials to be called as it normally would. |  1407   // We want SetRemoteIceParameters to be called as it normally would. | 
|  1399   // Otherwise we won't know what credentials to use for the expected |  1408   // Otherwise we won't know what parameters to use for the expected | 
|  1400   // prflx TCP candidates. |  1409   // prflx TCP candidates. | 
|  1401   set_remote_ice_credential_source(FROM_SETICECREDENTIALS); |  1410   set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 
|  1402  |  1411  | 
|  1403   // Pause candidate so we could verify the candidate properties. |  1412   // Pause candidate so we could verify the candidate properties. | 
|  1404   PauseCandidates(0); |  1413   PauseCandidates(0); | 
|  1405   PauseCandidates(1); |  1414   PauseCandidates(1); | 
|  1406   CreateChannels(1); |  1415   CreateChannels(1); | 
|  1407  |  1416  | 
|  1408   // Verify tcp candidates. |  1417   // Verify tcp candidates. | 
|  1409   VerifySavedTcpCandidates(0, TCPTYPE_PASSIVE_STR); |  1418   VerifySavedTcpCandidates(0, TCPTYPE_PASSIVE_STR); | 
|  1410   VerifySavedTcpCandidates(1, TCPTYPE_ACTIVE_STR); |  1419   VerifySavedTcpCandidates(1, TCPTYPE_ACTIVE_STR); | 
|  1411  |  1420  | 
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1677 } |  1686 } | 
|  1678  |  1687  | 
|  1679 // Test that when the "presume_writable_when_fully_relayed" flag is set to |  1688 // Test that when the "presume_writable_when_fully_relayed" flag is set to | 
|  1680 // true and there's a TURN-TURN candidate pair, it's presumed to be writable |  1689 // true and there's a TURN-TURN candidate pair, it's presumed to be writable | 
|  1681 // as soon as it's created. |  1690 // as soon as it's created. | 
|  1682 TEST_F(P2PTransportChannelTest, TurnToTurnPresumedWritable) { |  1691 TEST_F(P2PTransportChannelTest, TurnToTurnPresumedWritable) { | 
|  1683   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |  1692   ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 
|  1684                      kDefaultPortAllocatorFlags); |  1693                      kDefaultPortAllocatorFlags); | 
|  1685   // Only configure one channel so we can control when the remote candidate |  1694   // Only configure one channel so we can control when the remote candidate | 
|  1686   // is added. |  1695   // is added. | 
|  1687   GetEndpoint(0)->cd1_.ch_.reset( |  1696   GetEndpoint(0)->cd1_.ch_.reset(CreateChannel( | 
|  1688       CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[0], |  1697       0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[0], kIceParams[1])); | 
|  1689                     kIcePwd[0], kIceUfrag[1], kIcePwd[1])); |  | 
|  1690   IceConfig config; |  1698   IceConfig config; | 
|  1691   config.presume_writable_when_fully_relayed = true; |  1699   config.presume_writable_when_fully_relayed = true; | 
|  1692   ep1_ch1()->SetIceConfig(config); |  1700   ep1_ch1()->SetIceConfig(config); | 
|  1693   ep1_ch1()->MaybeStartGathering(); |  1701   ep1_ch1()->MaybeStartGathering(); | 
|  1694   EXPECT_EQ_WAIT(IceGatheringState::kIceGatheringComplete, |  1702   EXPECT_EQ_WAIT(IceGatheringState::kIceGatheringComplete, | 
|  1695                  ep1_ch1()->gathering_state(), kDefaultTimeout); |  1703                  ep1_ch1()->gathering_state(), kDefaultTimeout); | 
|  1696   // Add two remote candidates; a host candidate (with higher priority) |  1704   // Add two remote candidates; a host candidate (with higher priority) | 
|  1697   // and TURN candidate. |  1705   // and TURN candidate. | 
|  1698   ep1_ch1()->AddRemoteCandidate( |  1706   ep1_ch1()->AddRemoteCandidate( | 
|  1699       CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100)); |  1707       CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100)); | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|  1725   virtual_socket_server()->UpdateDelayDistribution(); |  1733   virtual_socket_server()->UpdateDelayDistribution(); | 
|  1726  |  1734  | 
|  1727   ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, |  1735   ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, | 
|  1728                      kDefaultPortAllocatorFlags); |  1736                      kDefaultPortAllocatorFlags); | 
|  1729   // We want the remote TURN candidate to show up as prflx. To do this we need |  1737   // We want the remote TURN candidate to show up as prflx. To do this we need | 
|  1730   // to configure the server to accept packets from an address we haven't |  1738   // to configure the server to accept packets from an address we haven't | 
|  1731   // explicitly installed permission for. |  1739   // explicitly installed permission for. | 
|  1732   test_turn_server()->set_enable_permission_checks(false); |  1740   test_turn_server()->set_enable_permission_checks(false); | 
|  1733   IceConfig config; |  1741   IceConfig config; | 
|  1734   config.presume_writable_when_fully_relayed = true; |  1742   config.presume_writable_when_fully_relayed = true; | 
|  1735   GetEndpoint(0)->cd1_.ch_.reset( |  1743   GetEndpoint(0)->cd1_.ch_.reset(CreateChannel( | 
|  1736       CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[0], |  1744       0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[0], kIceParams[1])); | 
|  1737                     kIcePwd[0], kIceUfrag[1], kIcePwd[1])); |  1745   GetEndpoint(1)->cd1_.ch_.reset(CreateChannel( | 
|  1738   GetEndpoint(1)->cd1_.ch_.reset( |  1746       1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[1], kIceParams[0])); | 
|  1739       CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[1], |  | 
|  1740                     kIcePwd[1], kIceUfrag[0], kIcePwd[0])); |  | 
|  1741   ep1_ch1()->SetIceConfig(config); |  1747   ep1_ch1()->SetIceConfig(config); | 
|  1742   ep2_ch1()->SetIceConfig(config); |  1748   ep2_ch1()->SetIceConfig(config); | 
|  1743   // Don't signal candidates from channel 2, so that channel 1 sees the TURN |  1749   // Don't signal candidates from channel 2, so that channel 1 sees the TURN | 
|  1744   // candidate as peer reflexive. |  1750   // candidate as peer reflexive. | 
|  1745   PauseCandidates(1); |  1751   PauseCandidates(1); | 
|  1746   ep1_ch1()->MaybeStartGathering(); |  1752   ep1_ch1()->MaybeStartGathering(); | 
|  1747   ep2_ch1()->MaybeStartGathering(); |  1753   ep2_ch1()->MaybeStartGathering(); | 
|  1748  |  1754  | 
|  1749   // Wait for the TURN<->prflx connection. |  1755   // Wait for the TURN<->prflx connection. | 
|  1750   EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable(), |  1756   EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable(), | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|  1766  |  1772  | 
|  1767 // Test that a presumed-writable TURN<->TURN connection is preferred above an |  1773 // Test that a presumed-writable TURN<->TURN connection is preferred above an | 
|  1768 // unreliable connection (one that has failed to be pinged for some time). |  1774 // unreliable connection (one that has failed to be pinged for some time). | 
|  1769 TEST_F(P2PTransportChannelTest, PresumedWritablePreferredOverUnreliable) { |  1775 TEST_F(P2PTransportChannelTest, PresumedWritablePreferredOverUnreliable) { | 
|  1770   rtc::ScopedFakeClock fake_clock; |  1776   rtc::ScopedFakeClock fake_clock; | 
|  1771  |  1777  | 
|  1772   ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, |  1778   ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, | 
|  1773                      kDefaultPortAllocatorFlags); |  1779                      kDefaultPortAllocatorFlags); | 
|  1774   IceConfig config; |  1780   IceConfig config; | 
|  1775   config.presume_writable_when_fully_relayed = true; |  1781   config.presume_writable_when_fully_relayed = true; | 
|  1776   GetEndpoint(0)->cd1_.ch_.reset( |  1782   GetEndpoint(0)->cd1_.ch_.reset(CreateChannel( | 
|  1777       CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[0], |  1783       0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[0], kIceParams[1])); | 
|  1778                     kIcePwd[0], kIceUfrag[1], kIcePwd[1])); |  1784   GetEndpoint(1)->cd1_.ch_.reset(CreateChannel( | 
|  1779   GetEndpoint(1)->cd1_.ch_.reset( |  1785       1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[1], kIceParams[0])); | 
|  1780       CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[1], |  | 
|  1781                     kIcePwd[1], kIceUfrag[0], kIcePwd[0])); |  | 
|  1782   ep1_ch1()->SetIceConfig(config); |  1786   ep1_ch1()->SetIceConfig(config); | 
|  1783   ep2_ch1()->SetIceConfig(config); |  1787   ep2_ch1()->SetIceConfig(config); | 
|  1784   ep1_ch1()->MaybeStartGathering(); |  1788   ep1_ch1()->MaybeStartGathering(); | 
|  1785   ep2_ch1()->MaybeStartGathering(); |  1789   ep2_ch1()->MaybeStartGathering(); | 
|  1786   // Wait for initial connection as usual. |  1790   // Wait for initial connection as usual. | 
|  1787   EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |  1791   EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 
|  1788                                  ep1_ch1()->selected_connection()->writable() && |  1792                                  ep1_ch1()->selected_connection()->writable() && | 
|  1789                                  ep2_ch1()->receiving() && |  1793                                  ep2_ch1()->receiving() && | 
|  1790                                  ep2_ch1()->writable() && |  1794                                  ep2_ch1()->writable() && | 
|  1791                                  ep2_ch1()->selected_connection()->writable(), |  1795                                  ep2_ch1()->selected_connection()->writable(), | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|  1814 // address of the outermost NAT. |  1818 // address of the outermost NAT. | 
|  1815 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { |  1819 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { | 
|  1816  protected: |  1820  protected: | 
|  1817   void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { |  1821   void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { | 
|  1818     ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); |  1822     ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); | 
|  1819     rtc::NATSocketServer::Translator* outer_nat = |  1823     rtc::NATSocketServer::Translator* outer_nat = | 
|  1820         nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], |  1824         nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], | 
|  1821             static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); |  1825             static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); | 
|  1822     ConfigureEndpoint(outer_nat, 0, config1); |  1826     ConfigureEndpoint(outer_nat, 0, config1); | 
|  1823     ConfigureEndpoint(outer_nat, 1, config2); |  1827     ConfigureEndpoint(outer_nat, 1, config2); | 
|  1824     set_remote_ice_credential_source(FROM_SETICECREDENTIALS); |  1828     set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 
|  1825   } |  1829   } | 
|  1826   void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, |  1830   void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, | 
|  1827                          int endpoint, Config config) { |  1831                          int endpoint, Config config) { | 
|  1828     ASSERT(config <= NAT_SYMMETRIC); |  1832     ASSERT(config <= NAT_SYMMETRIC); | 
|  1829     if (config == OPEN) { |  1833     if (config == OPEN) { | 
|  1830       AddAddress(endpoint, kPrivateAddrs[endpoint]); |  1834       AddAddress(endpoint, kPrivateAddrs[endpoint]); | 
|  1831       nat->AddClient(kPrivateAddrs[endpoint]); |  1835       nat->AddClient(kPrivateAddrs[endpoint]); | 
|  1832     } else { |  1836     } else { | 
|  1833       AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); |  1837       AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); | 
|  1834       nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], |  1838       nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2010   // Adding alternate address will make sure |kPublicAddrs| has the higher |  2014   // Adding alternate address will make sure |kPublicAddrs| has the higher | 
|  2011   // priority than others. This is due to FakeNetwork::AddInterface method. |  2015   // priority than others. This is due to FakeNetwork::AddInterface method. | 
|  2012   AddAddress(0, kAlternateAddrs[0]); |  2016   AddAddress(0, kAlternateAddrs[0]); | 
|  2013   AddAddress(0, kPublicAddrs[0]); |  2017   AddAddress(0, kPublicAddrs[0]); | 
|  2014   AddAddress(1, kPublicAddrs[1]); |  2018   AddAddress(1, kPublicAddrs[1]); | 
|  2015  |  2019  | 
|  2016   // Use only local ports for simplicity. |  2020   // Use only local ports for simplicity. | 
|  2017   SetAllocatorFlags(0, kOnlyLocalPorts); |  2021   SetAllocatorFlags(0, kOnlyLocalPorts); | 
|  2018   SetAllocatorFlags(1, kOnlyLocalPorts); |  2022   SetAllocatorFlags(1, kOnlyLocalPorts); | 
|  2019  |  2023  | 
 |  2024   // We want it to set the remote ICE parameters when creating channels. | 
 |  2025   set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 
|  2020   // Create channels and let them go writable, as usual. |  2026   // Create channels and let them go writable, as usual. | 
|  2021   CreateChannels(1); |  2027   CreateChannels(1); | 
|  2022   ep1_ch1()->set_remote_supports_renomination(true); |  2028   ASSERT_TRUE(SetIceRenomination(ep1_ch1(), true)); | 
|  2023   EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |  2029   EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 
|  2024                                  ep2_ch1()->receiving() && |  2030                                  ep2_ch1()->receiving() && | 
|  2025                                  ep2_ch1()->writable(), |  2031                                  ep2_ch1()->writable(), | 
|  2026                              3000, clock); |  2032                              3000, clock); | 
|  2027   EXPECT_TRUE_SIMULATED_WAIT( |  2033   EXPECT_TRUE_SIMULATED_WAIT( | 
|  2028       ep2_ch1()->selected_connection()->remote_nomination() > 0 && |  2034       ep2_ch1()->selected_connection()->remote_nomination() > 0 && | 
|  2029           ep1_ch1()->selected_connection()->acked_nomination() > 0, |  2035           ep1_ch1()->selected_connection()->acked_nomination() > 0, | 
|  2030       kDefaultTimeout, clock); |  2036       kDefaultTimeout, clock); | 
|  2031   const Connection* selected_connection1 = ep1_ch1()->selected_connection(); |  2037   const Connection* selected_connection1 = ep1_ch1()->selected_connection(); | 
|  2032   Connection* selected_connection2 = |  2038   Connection* selected_connection2 = | 
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2538                                     public sigslot::has_slots<> { |  2544                                     public sigslot::has_slots<> { | 
|  2539  public: |  2545  public: | 
|  2540   P2PTransportChannelPingTest() |  2546   P2PTransportChannelPingTest() | 
|  2541       : pss_(new rtc::PhysicalSocketServer), |  2547       : pss_(new rtc::PhysicalSocketServer), | 
|  2542         vss_(new rtc::VirtualSocketServer(pss_.get())), |  2548         vss_(new rtc::VirtualSocketServer(pss_.get())), | 
|  2543         ss_scope_(vss_.get()) {} |  2549         ss_scope_(vss_.get()) {} | 
|  2544  |  2550  | 
|  2545  protected: |  2551  protected: | 
|  2546   void PrepareChannel(P2PTransportChannel* ch) { |  2552   void PrepareChannel(P2PTransportChannel* ch) { | 
|  2547     ch->SetIceRole(ICEROLE_CONTROLLING); |  2553     ch->SetIceRole(ICEROLE_CONTROLLING); | 
|  2548     ch->SetIceCredentials(kIceUfrag[0], kIcePwd[0]); |  2554     ch->SetIceParameters(kIceParams[0]); | 
|  2549     ch->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |  2555     ch->SetRemoteIceParameters(kIceParams[1]); | 
|  2550     ch->SignalSelectedCandidatePairChanged.connect( |  2556     ch->SignalSelectedCandidatePairChanged.connect( | 
|  2551         this, &P2PTransportChannelPingTest::OnSelectedCandidatePairChanged); |  2557         this, &P2PTransportChannelPingTest::OnSelectedCandidatePairChanged); | 
|  2552     ch->SignalReadyToSend.connect(this, |  2558     ch->SignalReadyToSend.connect(this, | 
|  2553                                   &P2PTransportChannelPingTest::OnReadyToSend); |  2559                                   &P2PTransportChannelPingTest::OnReadyToSend); | 
|  2554     ch->SignalStateChanged.connect( |  2560     ch->SignalStateChanged.connect( | 
|  2555         this, &P2PTransportChannelPingTest::OnChannelStateChanged); |  2561         this, &P2PTransportChannelPingTest::OnChannelStateChanged); | 
|  2556   } |  2562   } | 
|  2557  |  2563  | 
|  2558   Connection* WaitForConnectionTo(P2PTransportChannel* ch, |  2564   Connection* WaitForConnectionTo(P2PTransportChannel* ch, | 
|  2559                                   const std::string& ip, |  2565                                   const std::string& ip, | 
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2812   start = clock.TimeNanos(); |  2818   start = clock.TimeNanos(); | 
|  2813   ping_sent_before = conn->num_pings_sent(); |  2819   ping_sent_before = conn->num_pings_sent(); | 
|  2814   SIMULATED_WAIT(conn->num_pings_sent() == ping_sent_before + 1, 3000, clock); |  2820   SIMULATED_WAIT(conn->num_pings_sent() == ping_sent_before + 1, 3000, clock); | 
|  2815   ping_interval_ms = (clock.TimeNanos() - start) / rtc::kNumNanosecsPerMillisec; |  2821   ping_interval_ms = (clock.TimeNanos() - start) / rtc::kNumNanosecsPerMillisec; | 
|  2816   EXPECT_GE(ping_interval_ms, STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL); |  2822   EXPECT_GE(ping_interval_ms, STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL); | 
|  2817   EXPECT_LE(ping_interval_ms, |  2823   EXPECT_LE(ping_interval_ms, | 
|  2818             STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL + SCHEDULING_RANGE); |  2824             STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL + SCHEDULING_RANGE); | 
|  2819 } |  2825 } | 
|  2820  |  2826  | 
|  2821 // Test that we start pinging as soon as we have a connection and remote ICE |  2827 // Test that we start pinging as soon as we have a connection and remote ICE | 
|  2822 // credentials. |  2828 // parameters. | 
|  2823 TEST_F(P2PTransportChannelPingTest, PingingStartedAsSoonAsPossible) { |  2829 TEST_F(P2PTransportChannelPingTest, PingingStartedAsSoonAsPossible) { | 
|  2824   rtc::ScopedFakeClock clock; |  2830   rtc::ScopedFakeClock clock; | 
|  2825  |  2831  | 
|  2826   FakePortAllocator pa(rtc::Thread::Current(), nullptr); |  2832   FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 
|  2827   P2PTransportChannel ch("TestChannel", 1, &pa); |  2833   P2PTransportChannel ch("TestChannel", 1, &pa); | 
|  2828   ch.SetIceRole(ICEROLE_CONTROLLING); |  2834   ch.SetIceRole(ICEROLE_CONTROLLING); | 
|  2829   ch.SetIceCredentials(kIceUfrag[0], kIcePwd[0]); |  2835   ch.SetIceParameters(kIceParams[0]); | 
|  2830   ch.MaybeStartGathering(); |  2836   ch.MaybeStartGathering(); | 
|  2831   EXPECT_EQ_WAIT(IceGatheringState::kIceGatheringComplete, ch.gathering_state(), |  2837   EXPECT_EQ_WAIT(IceGatheringState::kIceGatheringComplete, ch.gathering_state(), | 
|  2832                  kDefaultTimeout); |  2838                  kDefaultTimeout); | 
|  2833  |  2839  | 
|  2834   // Simulate a binding request being received, creating a peer reflexive |  2840   // Simulate a binding request being received, creating a peer reflexive | 
|  2835   // candidate pair while we still don't have remote ICE credentials. |  2841   // candidate pair while we still don't have remote ICE parameters. | 
|  2836   IceMessage request; |  2842   IceMessage request; | 
|  2837   request.SetType(STUN_BINDING_REQUEST); |  2843   request.SetType(STUN_BINDING_REQUEST); | 
|  2838   request.AddAttribute( |  2844   request.AddAttribute( | 
|  2839       new StunByteStringAttribute(STUN_ATTR_USERNAME, kIceUfrag[1])); |  2845       new StunByteStringAttribute(STUN_ATTR_USERNAME, kIceUfrag[1])); | 
|  2840   uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24; |  2846   uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24; | 
|  2841   request.AddAttribute( |  2847   request.AddAttribute( | 
|  2842       new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority)); |  2848       new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority)); | 
|  2843   Port* port = GetPort(&ch); |  2849   Port* port = GetPort(&ch); | 
|  2844   ASSERT_NE(nullptr, port); |  2850   ASSERT_NE(nullptr, port); | 
|  2845   port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP, |  2851   port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP, | 
|  2846                              &request, kIceUfrag[1], false); |  2852                              &request, kIceUfrag[1], false); | 
|  2847   Connection* conn = GetConnectionTo(&ch, "1.1.1.1", 1); |  2853   Connection* conn = GetConnectionTo(&ch, "1.1.1.1", 1); | 
|  2848   ASSERT_NE(nullptr, conn); |  2854   ASSERT_NE(nullptr, conn); | 
|  2849  |  2855  | 
|  2850   // Simulate waiting for a second (and change) and verify that no pings were |  2856   // Simulate waiting for a second (and change) and verify that no pings were | 
|  2851   // sent, since we don't yet have remote ICE credentials. |  2857   // sent, since we don't yet have remote ICE parameters. | 
|  2852   SIMULATED_WAIT(conn->num_pings_sent() > 0, 1025, clock); |  2858   SIMULATED_WAIT(conn->num_pings_sent() > 0, 1025, clock); | 
|  2853   EXPECT_EQ(0, conn->num_pings_sent()); |  2859   EXPECT_EQ(0, conn->num_pings_sent()); | 
|  2854  |  2860  | 
|  2855   // Set remote ICE credentials. Now we should be able to ping. Ensure that |  2861   // Set remote ICE parameters. Now we should be able to ping. Ensure that | 
|  2856   // the first ping is sent as soon as possible, within one simulated clock |  2862   // the first ping is sent as soon as possible, within one simulated clock | 
|  2857   // tick. |  2863   // tick. | 
|  2858   ch.SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |  2864   ch.SetRemoteIceParameters(kIceParams[1]); | 
|  2859   EXPECT_TRUE_SIMULATED_WAIT(conn->num_pings_sent() > 0, 1, clock); |  2865   EXPECT_TRUE_SIMULATED_WAIT(conn->num_pings_sent() > 0, 1, clock); | 
|  2860 } |  2866 } | 
|  2861  |  2867  | 
|  2862 TEST_F(P2PTransportChannelPingTest, TestNoTriggeredChecksWhenWritable) { |  2868 TEST_F(P2PTransportChannelPingTest, TestNoTriggeredChecksWhenWritable) { | 
|  2863   FakePortAllocator pa(rtc::Thread::Current(), nullptr); |  2869   FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 
|  2864   P2PTransportChannel ch("trigger checks", 1, &pa); |  2870   P2PTransportChannel ch("trigger checks", 1, &pa); | 
|  2865   PrepareChannel(&ch); |  2871   PrepareChannel(&ch); | 
|  2866   ch.MaybeStartGathering(); |  2872   ch.MaybeStartGathering(); | 
|  2867   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 1)); |  2873   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 1)); | 
|  2868   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 2)); |  2874   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 2)); | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2912   // Pruning the connection reduces the set of active connections and changes |  2918   // Pruning the connection reduces the set of active connections and changes | 
|  2913   // the channel state. |  2919   // the channel state. | 
|  2914   conn1->Prune(); |  2920   conn1->Prune(); | 
|  2915   EXPECT_EQ_WAIT(STATE_FAILED, channel_state(), kDefaultTimeout); |  2921   EXPECT_EQ_WAIT(STATE_FAILED, channel_state(), kDefaultTimeout); | 
|  2916 } |  2922 } | 
|  2917  |  2923  | 
|  2918 // Test adding remote candidates with different ufrags. If a remote candidate |  2924 // Test adding remote candidates with different ufrags. If a remote candidate | 
|  2919 // is added with an old ufrag, it will be discarded. If it is added with a |  2925 // is added with an old ufrag, it will be discarded. If it is added with a | 
|  2920 // ufrag that was not seen before, it will be used to create connections |  2926 // ufrag that was not seen before, it will be used to create connections | 
|  2921 // although the ICE pwd in the remote candidate will be set when the ICE |  2927 // although the ICE pwd in the remote candidate will be set when the ICE | 
|  2922 // credentials arrive. If a remote candidate is added with the current ICE |  2928 // parameters arrive. If a remote candidate is added with the current ICE | 
|  2923 // ufrag, its pwd and generation will be set properly. |  2929 // ufrag, its pwd and generation will be set properly. | 
|  2924 TEST_F(P2PTransportChannelPingTest, TestAddRemoteCandidateWithVariousUfrags) { |  2930 TEST_F(P2PTransportChannelPingTest, TestAddRemoteCandidateWithVariousUfrags) { | 
|  2925   FakePortAllocator pa(rtc::Thread::Current(), nullptr); |  2931   FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 
|  2926   P2PTransportChannel ch("add candidate", 1, &pa); |  2932   P2PTransportChannel ch("add candidate", 1, &pa); | 
|  2927   PrepareChannel(&ch); |  2933   PrepareChannel(&ch); | 
|  2928   ch.MaybeStartGathering(); |  2934   ch.MaybeStartGathering(); | 
|  2929   // Add a candidate with a future ufrag. |  2935   // Add a candidate with a future ufrag. | 
|  2930   ch.AddRemoteCandidate( |  2936   ch.AddRemoteCandidate( | 
|  2931       CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 1, kIceUfrag[2])); |  2937       CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 1, kIceUfrag[2])); | 
|  2932   Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |  2938   Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 
|  2933   ASSERT_TRUE(conn1 != nullptr); |  2939   ASSERT_TRUE(conn1 != nullptr); | 
|  2934   const Candidate& candidate = conn1->remote_candidate(); |  2940   const Candidate& candidate = conn1->remote_candidate(); | 
|  2935   EXPECT_EQ(kIceUfrag[2], candidate.username()); |  2941   EXPECT_EQ(kIceUfrag[2], candidate.username()); | 
|  2936   EXPECT_TRUE(candidate.password().empty()); |  2942   EXPECT_TRUE(candidate.password().empty()); | 
|  2937   EXPECT_TRUE(FindNextPingableConnectionAndPingIt(&ch) == nullptr); |  2943   EXPECT_TRUE(FindNextPingableConnectionAndPingIt(&ch) == nullptr); | 
|  2938  |  2944  | 
|  2939   // Set the remote credentials with the "future" ufrag. |  2945   // Set the remote ICE parameters with the "future" ufrag. | 
|  2940   // This should set the ICE pwd in the remote candidate of |conn1|, making |  2946   // This should set the ICE pwd in the remote candidate of |conn1|, making | 
|  2941   // it pingable. |  2947   // it pingable. | 
|  2942   ch.SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]); |  2948   ch.SetRemoteIceParameters(kIceParams[2]); | 
|  2943   EXPECT_EQ(kIceUfrag[2], candidate.username()); |  2949   EXPECT_EQ(kIceUfrag[2], candidate.username()); | 
|  2944   EXPECT_EQ(kIcePwd[2], candidate.password()); |  2950   EXPECT_EQ(kIcePwd[2], candidate.password()); | 
|  2945   EXPECT_EQ(conn1, FindNextPingableConnectionAndPingIt(&ch)); |  2951   EXPECT_EQ(conn1, FindNextPingableConnectionAndPingIt(&ch)); | 
|  2946  |  2952  | 
|  2947   // Add a candidate with an old ufrag. No connection will be created. |  2953   // Add a candidate with an old ufrag. No connection will be created. | 
|  2948   ch.AddRemoteCandidate( |  2954   ch.AddRemoteCandidate( | 
|  2949       CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 2, kIceUfrag[1])); |  2955       CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 2, kIceUfrag[1])); | 
|  2950   rtc::Thread::Current()->ProcessMessages(500); |  2956   rtc::Thread::Current()->ProcessMessages(500); | 
|  2951   EXPECT_TRUE(GetConnectionTo(&ch, "2.2.2.2", 2) == nullptr); |  2957   EXPECT_TRUE(GetConnectionTo(&ch, "2.2.2.2", 2) == nullptr); | 
|  2952  |  2958  | 
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3188   ASSERT_TRUE(conn4 != nullptr); |  3194   ASSERT_TRUE(conn4 != nullptr); | 
|  3189   EXPECT_TRUE(port->sent_binding_response()); |  3195   EXPECT_TRUE(port->sent_binding_response()); | 
|  3190   // conn4 is not the selected connection yet because it is not writable. |  3196   // conn4 is not the selected connection yet because it is not writable. | 
|  3191   EXPECT_EQ(conn2, ch.selected_connection()); |  3197   EXPECT_EQ(conn2, ch.selected_connection()); | 
|  3192   conn4->ReceivedPingResponse(LOW_RTT, "id");  // Become writable. |  3198   conn4->ReceivedPingResponse(LOW_RTT, "id");  // Become writable. | 
|  3193   EXPECT_EQ_WAIT(conn4, ch.selected_connection(), kDefaultTimeout); |  3199   EXPECT_EQ_WAIT(conn4, ch.selected_connection(), kDefaultTimeout); | 
|  3194  |  3200  | 
|  3195   // Test that the request from an unknown address contains a ufrag from an old |  3201   // Test that the request from an unknown address contains a ufrag from an old | 
|  3196   // generation. |  3202   // generation. | 
|  3197   port->set_sent_binding_response(false); |  3203   port->set_sent_binding_response(false); | 
|  3198   ch.SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]); |  3204   ch.SetRemoteIceParameters(kIceParams[2]); | 
|  3199   ch.SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |  3205   ch.SetRemoteIceParameters(kIceParams[3]); | 
|  3200   port->SignalUnknownAddress(port, rtc::SocketAddress("5.5.5.5", 5), PROTO_UDP, |  3206   port->SignalUnknownAddress(port, rtc::SocketAddress("5.5.5.5", 5), PROTO_UDP, | 
|  3201                              &request, kIceUfrag[2], false); |  3207                              &request, kIceUfrag[2], false); | 
|  3202   Connection* conn5 = WaitForConnectionTo(&ch, "5.5.5.5", 5); |  3208   Connection* conn5 = WaitForConnectionTo(&ch, "5.5.5.5", 5); | 
|  3203   ASSERT_TRUE(conn5 != nullptr); |  3209   ASSERT_TRUE(conn5 != nullptr); | 
|  3204   EXPECT_TRUE(port->sent_binding_response()); |  3210   EXPECT_TRUE(port->sent_binding_response()); | 
|  3205   EXPECT_EQ(kIcePwd[2], conn5->remote_candidate().password()); |  3211   EXPECT_EQ(kIcePwd[2], conn5->remote_candidate().password()); | 
|  3206 } |  3212 } | 
|  3207  |  3213  | 
|  3208 // The controlled side will select a connection as the "selected connection" |  3214 // The controlled side will select a connection as the "selected connection" | 
|  3209 // based on media received until the controlling side nominates a connection, |  3215 // based on media received until the controlling side nominates a connection, | 
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3648   ch.MaybeStartGathering(); |  3654   ch.MaybeStartGathering(); | 
|  3649   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100)); |  3655   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100)); | 
|  3650   Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |  3656   Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 
|  3651   ASSERT_TRUE(conn1 != nullptr); |  3657   ASSERT_TRUE(conn1 != nullptr); | 
|  3652   conn1->ReceivedPingResponse(LOW_RTT, "id");  // Becomes writable and receiving |  3658   conn1->ReceivedPingResponse(LOW_RTT, "id");  // Becomes writable and receiving | 
|  3653   EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); |  3659   EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); | 
|  3654  |  3660  | 
|  3655   // Start a new session. Even though conn1, which belongs to an older |  3661   // Start a new session. Even though conn1, which belongs to an older | 
|  3656   // session, becomes unwritable and writable again, it should not stop the |  3662   // session, becomes unwritable and writable again, it should not stop the | 
|  3657   // current session. |  3663   // current session. | 
|  3658   ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]); |  3664   ch.SetIceParameters(kIceParams[1]); | 
|  3659   ch.MaybeStartGathering(); |  3665   ch.MaybeStartGathering(); | 
|  3660   conn1->Prune(); |  3666   conn1->Prune(); | 
|  3661   conn1->ReceivedPingResponse(LOW_RTT, "id"); |  3667   conn1->ReceivedPingResponse(LOW_RTT, "id"); | 
|  3662   EXPECT_TRUE(ch.allocator_session()->IsGettingPorts()); |  3668   EXPECT_TRUE(ch.allocator_session()->IsGettingPorts()); | 
|  3663  |  3669  | 
|  3664   // But if a new connection created from the new session becomes writable, |  3670   // But if a new connection created from the new session becomes writable, | 
|  3665   // it will stop the current session. |  3671   // it will stop the current session. | 
|  3666   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 100)); |  3672   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 100)); | 
|  3667   Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |  3673   Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 
|  3668   ASSERT_TRUE(conn2 != nullptr); |  3674   ASSERT_TRUE(conn2 != nullptr); | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3704   // Starts with ICEROLE_CONTROLLING. |  3710   // Starts with ICEROLE_CONTROLLING. | 
|  3705   PrepareChannel(&ch); |  3711   PrepareChannel(&ch); | 
|  3706   ch.MaybeStartGathering(); |  3712   ch.MaybeStartGathering(); | 
|  3707   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 1)); |  3713   ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 1)); | 
|  3708  |  3714  | 
|  3709   Connection* conn = WaitForConnectionTo(&ch, "1.1.1.1", 1); |  3715   Connection* conn = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 
|  3710   ASSERT_TRUE(conn != nullptr); |  3716   ASSERT_TRUE(conn != nullptr); | 
|  3711  |  3717  | 
|  3712   // Do an ICE restart, change the role, and expect the old port to have its |  3718   // Do an ICE restart, change the role, and expect the old port to have its | 
|  3713   // role updated. |  3719   // role updated. | 
|  3714   ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]); |  3720   ch.SetIceParameters(kIceParams[1]); | 
|  3715   ch.MaybeStartGathering(); |  3721   ch.MaybeStartGathering(); | 
|  3716   ch.SetIceRole(ICEROLE_CONTROLLED); |  3722   ch.SetIceRole(ICEROLE_CONTROLLED); | 
|  3717   EXPECT_EQ(ICEROLE_CONTROLLED, conn->port()->GetIceRole()); |  3723   EXPECT_EQ(ICEROLE_CONTROLLED, conn->port()->GetIceRole()); | 
|  3718 } |  3724 } | 
|  3719  |  3725  | 
|  3720 // Test that after some amount of time without receiving data, the connection |  3726 // Test that after some amount of time without receiving data, the connection | 
|  3721 // will be destroyed. The port will only be destroyed after it is marked as |  3727 // will be destroyed. The port will only be destroyed after it is marked as | 
|  3722 // "pruned." |  3728 // "pruned." | 
|  3723 TEST_F(P2PTransportChannelPingTest, TestPortDestroyedAfterTimeoutAndPruned) { |  3729 TEST_F(P2PTransportChannelPingTest, TestPortDestroyedAfterTimeoutAndPruned) { | 
|  3724   rtc::ScopedFakeClock fake_clock; |  3730   rtc::ScopedFakeClock fake_clock; | 
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3954  |  3960  | 
|  3955   // TCP Relay/Relay is the next. |  3961   // TCP Relay/Relay is the next. | 
|  3956   VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, |  3962   VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, | 
|  3957                                TCP_PROTOCOL_NAME); |  3963                                TCP_PROTOCOL_NAME); | 
|  3958  |  3964  | 
|  3959   // Finally, Local/Relay will be pinged. |  3965   // Finally, Local/Relay will be pinged. | 
|  3960   VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); |  3966   VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); | 
|  3961 } |  3967 } | 
|  3962  |  3968  | 
|  3963 }  // namespace cricket { |  3969 }  // namespace cricket { | 
| OLD | NEW |