OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 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 #include "webrtc/base/gunit.h" | 10 #include "webrtc/base/gunit.h" |
11 #include "webrtc/base/socket_unittest.h" | 11 #include "webrtc/base/socket_unittest.h" |
12 #include "webrtc/base/thread.h" | 12 #include "webrtc/base/thread.h" |
13 #include "webrtc/base/win32socketserver.h" | 13 #include "webrtc/base/win32socketserver.h" |
14 | 14 |
15 namespace rtc { | 15 namespace rtc { |
16 | 16 |
17 // Test that Win32SocketServer::Wait works as expected. | 17 // Test that Win32SocketServer::Wait works as expected. |
18 TEST(Win32SocketServerTest, TestWait) { | 18 TEST(Win32SocketServerTest, TestWait) { |
19 Win32SocketServer server(NULL); | 19 Win32SocketServer server(nullptr); |
20 uint32_t start = Time(); | 20 uint32_t start = Time(); |
21 server.Wait(1000, true); | 21 server.Wait(1000, true); |
22 EXPECT_GE(TimeSince(start), 1000); | 22 EXPECT_GE(TimeSince(start), 1000); |
23 } | 23 } |
24 | 24 |
25 // Test that Win32Socket::Pump does not touch general Windows messages. | 25 // Test that Win32Socket::Pump does not touch general Windows messages. |
26 TEST(Win32SocketServerTest, TestPump) { | 26 TEST(Win32SocketServerTest, TestPump) { |
27 Win32SocketServer server(NULL); | 27 Win32SocketServer server(nullptr); |
28 SocketServerScope scope(&server); | 28 SocketServerScope scope(&server); |
29 EXPECT_EQ(TRUE, PostMessage(NULL, WM_USER, 999, 0)); | 29 EXPECT_EQ(TRUE, PostMessage(nullptr, WM_USER, 999, 0)); |
30 server.Pump(); | 30 server.Pump(); |
31 MSG msg; | 31 MSG msg; |
32 EXPECT_EQ(TRUE, PeekMessage(&msg, NULL, WM_USER, 0, PM_REMOVE)); | 32 EXPECT_EQ(TRUE, PeekMessage(&msg, nullptr, WM_USER, 0, PM_REMOVE)); |
33 EXPECT_EQ(static_cast<UINT>(WM_USER), msg.message); | 33 EXPECT_EQ(static_cast<UINT>(WM_USER), msg.message); |
34 EXPECT_EQ(999u, msg.wParam); | 34 EXPECT_EQ(999u, msg.wParam); |
35 } | 35 } |
36 | 36 |
37 // Test that Win32Socket passes all the generic Socket tests. | 37 // Test that Win32Socket passes all the generic Socket tests. |
38 class Win32SocketTest : public SocketTest { | 38 class Win32SocketTest : public SocketTest { |
39 protected: | 39 protected: |
40 Win32SocketTest() : server_(NULL), scope_(&server_) {} | 40 Win32SocketTest() : server_(nullptr), scope_(&server_) {} |
41 Win32SocketServer server_; | 41 Win32SocketServer server_; |
42 SocketServerScope scope_; | 42 SocketServerScope scope_; |
43 }; | 43 }; |
44 | 44 |
45 TEST_F(Win32SocketTest, TestConnectIPv4) { | 45 TEST_F(Win32SocketTest, TestConnectIPv4) { |
46 SocketTest::TestConnectIPv4(); | 46 SocketTest::TestConnectIPv4(); |
47 } | 47 } |
48 | 48 |
49 TEST_F(Win32SocketTest, TestConnectIPv6) { | 49 TEST_F(Win32SocketTest, TestConnectIPv6) { |
50 SocketTest::TestConnectIPv6(); | 50 SocketTest::TestConnectIPv6(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SocketTest::TestGetSetOptionsIPv4(); | 152 SocketTest::TestGetSetOptionsIPv4(); |
153 } | 153 } |
154 | 154 |
155 // Breaks win_x64_dbg bot. | 155 // Breaks win_x64_dbg bot. |
156 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6178 | 156 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6178 |
157 TEST_F(Win32SocketTest, DISABLED_TestGetSetOptionsIPv6) { | 157 TEST_F(Win32SocketTest, DISABLED_TestGetSetOptionsIPv6) { |
158 SocketTest::TestGetSetOptionsIPv6(); | 158 SocketTest::TestGetSetOptionsIPv6(); |
159 } | 159 } |
160 | 160 |
161 } // namespace rtc | 161 } // namespace rtc |
OLD | NEW |