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

Unified Diff: net/socket/udp_socket_unittest.cc

Issue 2253753002: Always use NonBlocking IO for UDP sockets on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « net/socket/udp_socket_perftest.cc ('k') | net/socket/udp_socket_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/udp_socket_unittest.cc
diff --git a/net/socket/udp_socket_unittest.cc b/net/socket/udp_socket_unittest.cc
index 1a602125766aa3885adc848b5ac23d5a24b18555..e1116e0ff9981f0f876441c2612ff251c0ce8972 100644
--- a/net/socket/udp_socket_unittest.cc
+++ b/net/socket/udp_socket_unittest.cc
@@ -146,9 +146,7 @@ class UDPSocketTest : public PlatformTest {
}
// Run unit test for a connection test.
- // |use_nonblocking_io| is used to switch between overlapped and non-blocking
- // IO on Windows. It has no effect in other ports.
- void ConnectTest(bool use_nonblocking_io);
+ void ConnectTest();
protected:
static const int kMaxRead = 1024;
@@ -161,7 +159,7 @@ void ReadCompleteCallback(int* result_out, base::Closure callback, int result) {
callback.Run();
}
-void UDPSocketTest::ConnectTest(bool use_nonblocking_io) {
+TEST_F(UDPSocketTest, Connect) {
const uint16_t kPort = 9999;
std::string simple_message("hello world!");
@@ -171,8 +169,6 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) {
TestNetLog server_log;
std::unique_ptr<UDPServerSocket> server(
new UDPServerSocket(&server_log, NetLogSource()));
- if (use_nonblocking_io)
- server->UseNonBlockingIO();
server->AllowAddressReuse();
int rv = server->Listen(bind_address);
ASSERT_THAT(rv, IsOk());
@@ -184,8 +180,6 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) {
std::unique_ptr<UDPClientSocket> client(
new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
&client_log, NetLogSource()));
- if (use_nonblocking_io)
- client->UseNonBlockingIO();
rv = client->Connect(server_address);
EXPECT_THAT(rv, IsOk());
@@ -268,17 +262,6 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) {
LogContainsEndEvent(client_entries, 6, NetLogEventType::SOCKET_ALIVE));
}
-TEST_F(UDPSocketTest, Connect) {
- // The variable |use_nonblocking_io| has no effect in non-Windows ports.
- ConnectTest(false);
-}
-
-#if defined(OS_WIN)
-TEST_F(UDPSocketTest, ConnectNonBlocking) {
- ConnectTest(true);
-}
-#endif
-
#if defined(OS_MACOSX)
// UDPSocketPrivate_Broadcast is disabled for OSX because it requires
// root permissions on OSX 10.7+.
« no previous file with comments | « net/socket/udp_socket_perftest.cc ('k') | net/socket/udp_socket_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698