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

Side by Side Diff: webrtc/base/win32_unittest.cc

Issue 2866183004: Deleted unused method EstimateMTU, and the WinPing class. (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 unified diff | Download patch
« no previous file with comments | « webrtc/base/virtualsocketserver.cc ('k') | webrtc/base/win32socketserver.h » ('j') | 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 2010 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2010 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
11 #include <string> 11 #include <string>
12 12
13 #include "webrtc/base/gunit.h" 13 #include "webrtc/base/gunit.h"
14 #include "webrtc/base/nethelpers.h" 14 #include "webrtc/base/nethelpers.h"
15 #include "webrtc/base/win32.h" 15 #include "webrtc/base/win32.h"
16 #include "webrtc/base/winping.h"
17 16
18 #if !defined(WEBRTC_WIN) 17 #if !defined(WEBRTC_WIN)
19 #error Only for Windows 18 #error Only for Windows
20 #endif 19 #endif
21 20
22 namespace rtc { 21 namespace rtc {
23 22
24 class Win32Test : public testing::Test { 23 class Win32Test : public testing::Test {
25 public: 24 public:
26 Win32Test() { 25 Win32Test() {
27 } 26 }
28 }; 27 };
29 28
30 TEST_F(Win32Test, FileTimeToUInt64Test) { 29 TEST_F(Win32Test, FileTimeToUInt64Test) {
31 FILETIME ft; 30 FILETIME ft;
32 ft.dwHighDateTime = 0xBAADF00D; 31 ft.dwHighDateTime = 0xBAADF00D;
33 ft.dwLowDateTime = 0xFEED3456; 32 ft.dwLowDateTime = 0xFEED3456;
34 33
35 uint64_t expected = 0xBAADF00DFEED3456; 34 uint64_t expected = 0xBAADF00DFEED3456;
36 EXPECT_EQ(expected, ToUInt64(ft)); 35 EXPECT_EQ(expected, ToUInt64(ft));
37 } 36 }
38 37
39 TEST_F(Win32Test, WinPingTest) {
40 WinPing ping;
41 ASSERT_TRUE(ping.IsValid());
42
43 // Test valid ping cases.
44 WinPing::PingResult result = ping.Ping(IPAddress(INADDR_LOOPBACK), 20, 50, 1,
45 false);
46 ASSERT_EQ(WinPing::PING_SUCCESS, result);
47 if (HasIPv6Enabled()) {
48 WinPing::PingResult v6result = ping.Ping(IPAddress(in6addr_loopback), 20,
49 50, 1, false);
50 ASSERT_EQ(WinPing::PING_SUCCESS, v6result);
51 }
52
53 // Test invalid parameter cases.
54 ASSERT_EQ(WinPing::PING_INVALID_PARAMS, ping.Ping(
55 IPAddress(INADDR_LOOPBACK), 0, 50, 1, false));
56 ASSERT_EQ(WinPing::PING_INVALID_PARAMS, ping.Ping(
57 IPAddress(INADDR_LOOPBACK), 20, 0, 1, false));
58 ASSERT_EQ(WinPing::PING_INVALID_PARAMS, ping.Ping(
59 IPAddress(INADDR_LOOPBACK), 20, 50, 0, false));
60 }
61
62 TEST_F(Win32Test, IPv6AddressCompression) { 38 TEST_F(Win32Test, IPv6AddressCompression) {
63 IPAddress ipv6; 39 IPAddress ipv6;
64 40
65 // Zero compression should be done on the leftmost 0s when there are 41 // Zero compression should be done on the leftmost 0s when there are
66 // multiple longest series. 42 // multiple longest series.
67 ASSERT_TRUE(IPFromString("2a00:8a00:a000:1190:0000:0001:000:252", &ipv6)); 43 ASSERT_TRUE(IPFromString("2a00:8a00:a000:1190:0000:0001:000:252", &ipv6));
68 EXPECT_EQ("2a00:8a00:a000:1190::1:0:252", ipv6.ToString()); 44 EXPECT_EQ("2a00:8a00:a000:1190::1:0:252", ipv6.ToString());
69 45
70 // Ensure the zero compression could handle multiple octects. 46 // Ensure the zero compression could handle multiple octects.
71 ASSERT_TRUE(IPFromString("0:0:0:0:0:0:0:1", &ipv6)); 47 ASSERT_TRUE(IPFromString("0:0:0:0:0:0:0:1", &ipv6));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 EXPECT_FALSE(IPFromString("abcde::1", &ipv6)); 89 EXPECT_FALSE(IPFromString("abcde::1", &ipv6));
114 90
115 // More than 8 groups. 91 // More than 8 groups.
116 EXPECT_FALSE(IPFromString("1:2:3:4:5:6:7:8:9", &ipv6)); 92 EXPECT_FALSE(IPFromString("1:2:3:4:5:6:7:8:9", &ipv6));
117 93
118 // Less than 8 groups. 94 // Less than 8 groups.
119 EXPECT_FALSE(IPFromString("1:2:3:4:5:6:7", &ipv6)); 95 EXPECT_FALSE(IPFromString("1:2:3:4:5:6:7", &ipv6));
120 } 96 }
121 97
122 } // namespace rtc 98 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/virtualsocketserver.cc ('k') | webrtc/base/win32socketserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698