Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 case NAT_SYMMETRIC: return "stun(symmetric)"; | 549 case NAT_SYMMETRIC: return "stun(symmetric)"; |
| 550 default: return "stun(?)"; | 550 default: return "stun(?)"; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 static const char* RelayName(RelayType type, ProtocolType proto) { | 553 static const char* RelayName(RelayType type, ProtocolType proto) { |
| 554 if (type == RELAY_TURN) { | 554 if (type == RELAY_TURN) { |
| 555 switch (proto) { | 555 switch (proto) { |
| 556 case PROTO_UDP: return "turn(udp)"; | 556 case PROTO_UDP: return "turn(udp)"; |
| 557 case PROTO_TCP: return "turn(tcp)"; | 557 case PROTO_TCP: return "turn(tcp)"; |
| 558 case PROTO_SSLTCP: return "turn(ssltcp)"; | 558 case PROTO_SSLTCP: return "turn(ssltcp)"; |
| 559 case PROTO_TLS: | |
| 560 return "turn(tls)"; | |
|
pthatcher1
2016/12/07 21:29:35
Can you make the style here consistent? And below
hnsl1
2016/12/12 16:08:13
Done in separate CL.
| |
| 559 default: return "turn(?)"; | 561 default: return "turn(?)"; |
| 560 } | 562 } |
| 561 } else { | 563 } else { |
| 562 switch (proto) { | 564 switch (proto) { |
| 563 case PROTO_UDP: return "gturn(udp)"; | 565 case PROTO_UDP: return "gturn(udp)"; |
| 564 case PROTO_TCP: return "gturn(tcp)"; | 566 case PROTO_TCP: return "gturn(tcp)"; |
| 565 case PROTO_SSLTCP: return "gturn(ssltcp)"; | 567 case PROTO_SSLTCP: return "gturn(ssltcp)"; |
| 568 case PROTO_TLS: | |
| 569 return "gturn(tls)"; | |
| 566 default: return "gturn(?)"; | 570 default: return "gturn(?)"; |
| 567 } | 571 } |
| 568 } | 572 } |
| 569 } | 573 } |
| 570 | 574 |
| 571 void SetNetworkType(rtc::AdapterType adapter_type) { | 575 void SetNetworkType(rtc::AdapterType adapter_type) { |
| 572 network_.set_type(adapter_type); | 576 network_.set_type(adapter_type); |
| 573 } | 577 } |
| 574 | 578 |
| 575 void TestCrossFamilyPorts(int type); | 579 void TestCrossFamilyPorts(int type); |
| (...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2370 EXPECT_TRUE(cand1.priority() > cand2.priority()); | 2374 EXPECT_TRUE(cand1.priority() > cand2.priority()); |
| 2371 } | 2375 } |
| 2372 | 2376 |
| 2373 // Test the Connection priority is calculated correctly. | 2377 // Test the Connection priority is calculated correctly. |
| 2374 TEST_F(PortTest, TestConnectionPriority) { | 2378 TEST_F(PortTest, TestConnectionPriority) { |
| 2375 std::unique_ptr<TestPort> lport( | 2379 std::unique_ptr<TestPort> lport( |
| 2376 CreateTestPort(kLocalAddr1, "lfrag", "lpass")); | 2380 CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
| 2377 lport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_HOST); | 2381 lport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_HOST); |
| 2378 std::unique_ptr<TestPort> rport( | 2382 std::unique_ptr<TestPort> rport( |
| 2379 CreateTestPort(kLocalAddr2, "rfrag", "rpass")); | 2383 CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
| 2380 rport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_RELAY); | 2384 rport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_RELAY_UDP); |
| 2381 lport->set_component(123); | 2385 lport->set_component(123); |
| 2382 lport->AddCandidateAddress(SocketAddress("192.168.1.4", 1234)); | 2386 lport->AddCandidateAddress(SocketAddress("192.168.1.4", 1234)); |
| 2383 rport->set_component(23); | 2387 rport->set_component(23); |
| 2384 rport->AddCandidateAddress(SocketAddress("10.1.1.100", 1234)); | 2388 rport->AddCandidateAddress(SocketAddress("10.1.1.100", 1234)); |
| 2385 | 2389 |
| 2386 EXPECT_EQ(0x7E001E85U, lport->Candidates()[0].priority()); | 2390 EXPECT_EQ(0x7E001E85U, lport->Candidates()[0].priority()); |
| 2387 EXPECT_EQ(0x2001EE9U, rport->Candidates()[0].priority()); | 2391 EXPECT_EQ(0x2001EE9U, rport->Candidates()[0].priority()); |
| 2388 | 2392 |
| 2389 // RFC 5245 | 2393 // RFC 5245 |
| 2390 // pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0) | 2394 // pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0) |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2745 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); | 2749 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); |
| 2746 EXPECT_NE(conn1, conn2); | 2750 EXPECT_NE(conn1, conn2); |
| 2747 conn_in_use = port->GetConnection(address); | 2751 conn_in_use = port->GetConnection(address); |
| 2748 EXPECT_EQ(conn2, conn_in_use); | 2752 EXPECT_EQ(conn2, conn_in_use); |
| 2749 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); | 2753 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); |
| 2750 | 2754 |
| 2751 // Make sure the new connection was not deleted. | 2755 // Make sure the new connection was not deleted. |
| 2752 rtc::Thread::Current()->ProcessMessages(300); | 2756 rtc::Thread::Current()->ProcessMessages(300); |
| 2753 EXPECT_TRUE(port->GetConnection(address) != nullptr); | 2757 EXPECT_TRUE(port->GetConnection(address) != nullptr); |
| 2754 } | 2758 } |
| OLD | NEW |