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

Side by Side Diff: webrtc/p2p/base/port_unittest.cc

Issue 2685053004: Add the URL attribute to cricket::Candiate. (Closed)
Patch Set: CR comments. Created 3 years, 10 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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (error_attr) { 139 if (error_attr) {
140 code = error_attr->code(); 140 code = error_attr->code();
141 } 141 }
142 } 142 }
143 return code; 143 return code;
144 } 144 }
145 145
146 virtual void PrepareAddress() { 146 virtual void PrepareAddress() {
147 rtc::SocketAddress addr(ip(), min_port()); 147 rtc::SocketAddress addr(ip(), min_port());
148 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", "", Type(), 148 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", "", Type(),
149 ICE_TYPE_PREFERENCE_HOST, 0, true); 149 ICE_TYPE_PREFERENCE_HOST, 0, "", true);
150 } 150 }
151 151
152 virtual bool SupportsProtocol(const std::string& protocol) const { 152 virtual bool SupportsProtocol(const std::string& protocol) const {
153 return true; 153 return true;
154 } 154 }
155 155
156 virtual ProtocolType GetProtocol() const { return PROTO_UDP; } 156 virtual ProtocolType GetProtocol() const { return PROTO_UDP; }
157 157
158 // Exposed for testing candidate building. 158 // Exposed for testing candidate building.
159 void AddCandidateAddress(const rtc::SocketAddress& addr) { 159 void AddCandidateAddress(const rtc::SocketAddress& addr) {
160 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", "", Type(), 160 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", "", Type(),
161 type_preference_, 0, false); 161 type_preference_, 0, "", false);
162 } 162 }
163 void AddCandidateAddress(const rtc::SocketAddress& addr, 163 void AddCandidateAddress(const rtc::SocketAddress& addr,
164 const rtc::SocketAddress& base_address, 164 const rtc::SocketAddress& base_address,
165 const std::string& type, 165 const std::string& type,
166 int type_preference, 166 int type_preference,
167 bool final) { 167 bool final) {
168 AddAddress(addr, base_address, rtc::SocketAddress(), "udp", "", "", type, 168 AddAddress(addr, base_address, rtc::SocketAddress(), "udp", "", "", type,
169 type_preference, 0, final); 169 type_preference, 0, "", final);
170 } 170 }
171 171
172 virtual Connection* CreateConnection(const Candidate& remote_candidate, 172 virtual Connection* CreateConnection(const Candidate& remote_candidate,
173 CandidateOrigin origin) { 173 CandidateOrigin origin) {
174 Connection* conn = new ProxyConnection(this, 0, remote_candidate); 174 Connection* conn = new ProxyConnection(this, 0, remote_candidate);
175 AddOrReplaceConnection(conn); 175 AddOrReplaceConnection(conn);
176 // Set use-candidate attribute flag as this will add USE-CANDIDATE attribute 176 // Set use-candidate attribute flag as this will add USE-CANDIDATE attribute
177 // in STUN binding requests. 177 // in STUN binding requests.
178 conn->set_use_candidate_attr(true); 178 conn->set_use_candidate_attr(true);
179 return conn; 179 return conn;
(...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); 2762 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE);
2763 EXPECT_NE(conn1, conn2); 2763 EXPECT_NE(conn1, conn2);
2764 conn_in_use = port->GetConnection(address); 2764 conn_in_use = port->GetConnection(address);
2765 EXPECT_EQ(conn2, conn_in_use); 2765 EXPECT_EQ(conn2, conn_in_use);
2766 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); 2766 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation());
2767 2767
2768 // Make sure the new connection was not deleted. 2768 // Make sure the new connection was not deleted.
2769 rtc::Thread::Current()->ProcessMessages(300); 2769 rtc::Thread::Current()->ProcessMessages(300);
2770 EXPECT_TRUE(port->GetConnection(address) != nullptr); 2770 EXPECT_TRUE(port->GetConnection(address) != nullptr);
2771 } 2771 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698