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

Unified Diff: webrtc/base/testclient_unittest.cc

Issue 2881973002: Get tests working on systems that only support IPv6. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/base/testclient_unittest.cc
diff --git a/webrtc/base/testclient_unittest.cc b/webrtc/base/testclient_unittest.cc
index 685499448f34ae31e84cac3057a33932640b48de..8392abfa94dca5510e99473779fe3d8b4d6caa0d 100644
--- a/webrtc/base/testclient_unittest.cc
+++ b/webrtc/base/testclient_unittest.cc
@@ -18,6 +18,18 @@
using namespace rtc;
+#define MAYBE_SKIP_IPV4 \
+ if (!HasIPv4Enabled()) { \
+ LOG(LS_INFO) << "No IPv4... skipping"; \
+ return; \
+ }
+
+#define MAYBE_SKIP_IPV6 \
+ if (!HasIPv6Enabled()) { \
+ LOG(LS_INFO) << "No IPv6... skipping"; \
+ return; \
+ }
+
void TestUdpInternal(const SocketAddress& loopback) {
Thread *main = Thread::Current();
AsyncSocket* socket = main->socketserver()
@@ -53,6 +65,7 @@ void TestTcpInternal(const SocketAddress& loopback) {
// Tests whether the TestClient can send UDP to itself.
TEST(TestClientTest, TestUdpIPv4) {
+ MAYBE_SKIP_IPV4;
TestUdpInternal(SocketAddress("127.0.0.1", 0));
}
@@ -62,15 +75,13 @@ TEST(TestClientTest, TestUdpIPv4) {
#define MAYBE_TestUdpIPv6 TestUdpIPv6
#endif
TEST(TestClientTest, MAYBE_TestUdpIPv6) {
- if (HasIPv6Enabled()) {
- TestUdpInternal(SocketAddress("::1", 0));
- } else {
- LOG(LS_INFO) << "Skipping IPv6 test.";
- }
+ MAYBE_SKIP_IPV6;
+ TestUdpInternal(SocketAddress("::1", 0));
}
// Tests whether the TestClient can connect to a server and exchange data.
TEST(TestClientTest, TestTcpIPv4) {
+ MAYBE_SKIP_IPV4;
TestTcpInternal(SocketAddress("127.0.0.1", 0));
}
@@ -80,9 +91,6 @@ TEST(TestClientTest, TestTcpIPv4) {
#define MAYBE_TestTcpIPv6 TestTcpIPv6
#endif
TEST(TestClientTest, MAYBE_TestTcpIPv6) {
- if (HasIPv6Enabled()) {
- TestTcpInternal(SocketAddress("::1", 0));
- } else {
- LOG(LS_INFO) << "Skipping IPv6 test.";
- }
+ MAYBE_SKIP_IPV6;
+ TestTcpInternal(SocketAddress("::1", 0));
}

Powered by Google App Engine
This is Rietveld 408576698