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

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

Issue 1218293016: Tighten link-local IPv6 routing exclusion check (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 } 1387 }
1388 1388
1389 TEST_F(PortTest, TestSkipCrossFamilyTcp) { 1389 TEST_F(PortTest, TestSkipCrossFamilyTcp) {
1390 TestCrossFamilyPorts(SOCK_STREAM); 1390 TestCrossFamilyPorts(SOCK_STREAM);
1391 } 1391 }
1392 1392
1393 TEST_F(PortTest, TestSkipCrossFamilyUdp) { 1393 TEST_F(PortTest, TestSkipCrossFamilyUdp) {
1394 TestCrossFamilyPorts(SOCK_DGRAM); 1394 TestCrossFamilyPorts(SOCK_DGRAM);
1395 } 1395 }
1396 1396
1397 TEST_F(PortTest, TestUdpV6CrossTypePorts) {
1398 FakePacketSocketFactory factory;
1399 scoped_ptr<Port> ports[3];
1400 SocketAddress addresses[3] = {SocketAddress("2001:db8::1", 0),
1401 SocketAddress("fe80::1", 0),
1402 SocketAddress("::1", 0)};
1403 for (int i = 0; i < 3; i++) {
1404 FakeAsyncPacketSocket *socket = new FakeAsyncPacketSocket();
1405 factory.set_next_udp_socket(socket);
1406 ports[i].reset(CreateUdpPort(addresses[i], &factory));
1407 socket->set_state(AsyncPacketSocket::STATE_BINDING);
1408 socket->SignalAddressReady(socket, addresses[i]);
1409 ports[i]->PrepareAddress();
1410 }
1411
1412 // Standard address connecting to link-local should fail.
1413 Connection* c = ports[0]->CreateConnection(GetCandidate(ports[1].get()),
1414 Port::ORIGIN_MESSAGE);
1415 EXPECT_TRUE(NULL == c);
1416 EXPECT_EQ(0U, ports[0]->connections().size());
pthatcher1 2015/07/07 18:11:16 Should we also need a test cases for other combina
bemasc2 2015/07/07 19:26:00 Done.
1417
1418 // Standard address connecting to localhost should succeed.
1419 c = ports[0]->CreateConnection(GetCandidate(ports[2].get()),
1420 Port::ORIGIN_MESSAGE);
1421 EXPECT_FALSE(NULL == c);
1422 EXPECT_EQ(1U, ports[0]->connections().size());
1423 }
1424
1397 // This test verifies DSCP value set through SetOption interface can be 1425 // This test verifies DSCP value set through SetOption interface can be
1398 // get through DefaultDscpValue. 1426 // get through DefaultDscpValue.
1399 TEST_F(PortTest, TestDefaultDscpValue) { 1427 TEST_F(PortTest, TestDefaultDscpValue) {
1400 int dscp; 1428 int dscp;
1401 rtc::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1)); 1429 rtc::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1));
1402 EXPECT_EQ(0, udpport->SetOption(rtc::Socket::OPT_DSCP, 1430 EXPECT_EQ(0, udpport->SetOption(rtc::Socket::OPT_DSCP,
1403 rtc::DSCP_CS6)); 1431 rtc::DSCP_CS6));
1404 EXPECT_EQ(0, udpport->GetOption(rtc::Socket::OPT_DSCP, &dscp)); 1432 EXPECT_EQ(0, udpport->GetOption(rtc::Socket::OPT_DSCP, &dscp));
1405 rtc::scoped_ptr<TCPPort> tcpport(CreateTcpPort(kLocalAddr1)); 1433 rtc::scoped_ptr<TCPPort> tcpport(CreateTcpPort(kLocalAddr1));
1406 EXPECT_EQ(0, tcpport->SetOption(rtc::Socket::OPT_DSCP, 1434 EXPECT_EQ(0, tcpport->SetOption(rtc::Socket::OPT_DSCP,
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 // Set up channels and ensure both ports will be deleted. 2624 // Set up channels and ensure both ports will be deleted.
2597 TestChannel ch1(port1, port2); 2625 TestChannel ch1(port1, port2);
2598 TestChannel ch2(port2, port1); 2626 TestChannel ch2(port2, port1);
2599 2627
2600 // Simulate a connection that succeeds, and then is destroyed. 2628 // Simulate a connection that succeeds, and then is destroyed.
2601 StartConnectAndStopChannels(&ch1, &ch2); 2629 StartConnectAndStopChannels(&ch1, &ch2);
2602 2630
2603 // The controlled port should be destroyed after 10 milliseconds. 2631 // The controlled port should be destroyed after 10 milliseconds.
2604 EXPECT_TRUE_WAIT(destroyed(), kTimeout); 2632 EXPECT_TRUE_WAIT(destroyed(), kTimeout);
2605 } 2633 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698