Index: chrome/test/chromedriver/net/net_util_unittest.cc |
diff --git a/chrome/test/chromedriver/net/net_util_unittest.cc b/chrome/test/chromedriver/net/net_util_unittest.cc |
index e4d8b14db1afdfbd569eab18e8acfe49fa2c203e..dbe41d042c6bd4cfa1206ff82ce9a0ba63e5150f 100644 |
--- a/chrome/test/chromedriver/net/net_util_unittest.cc |
+++ b/chrome/test/chromedriver/net/net_util_unittest.cc |
@@ -20,7 +20,7 @@ |
#include "net/base/net_errors.h" |
#include "net/server/http_server.h" |
#include "net/server/http_server_request_info.h" |
-#include "net/socket/tcp_listen_socket.h" |
+#include "net/socket/tcp_server_socket.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -54,8 +54,10 @@ class FetchUrlTest : public testing::Test, |
} |
void InitOnIO(base::WaitableEvent* event) { |
- net::TCPListenSocketFactory factory("127.0.0.1", 0); |
- server_ = new net::HttpServer(factory, this); |
+ scoped_ptr<net::ServerSocket> server_socket( |
+ new net::TCPServerSocket(NULL, net::NetLog::Source())); |
+ server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1); |
+ server_.reset(new net::HttpServer(server_socket.Pass(), this)); |
net::IPEndPoint address; |
CHECK_EQ(net::OK, server_->GetLocalAddress(&address)); |
server_url_ = base::StringPrintf("http://127.0.0.1:%d", address.port()); |
@@ -63,7 +65,7 @@ class FetchUrlTest : public testing::Test, |
} |
void DestroyServerOnIO(base::WaitableEvent* event) { |
- server_ = NULL; |
+ server_.reset(NULL); |
event->Signal(); |
} |
@@ -78,10 +80,7 @@ class FetchUrlTest : public testing::Test, |
server_->Send404(connection_id); |
break; |
case kClose: |
- // net::HttpServer doesn't allow us to close connection during callback. |
- base::MessageLoop::current()->PostTask( |
- FROM_HERE, |
- base::Bind(&net::HttpServer::Close, server_, connection_id)); |
+ server_->Close(connection_id); |
break; |
default: |
break; |
@@ -104,7 +103,7 @@ class FetchUrlTest : public testing::Test, |
base::Thread io_thread_; |
ServerResponse response_; |
- scoped_refptr<net::HttpServer> server_; |
+ scoped_ptr<net::HttpServer> server_; |
scoped_refptr<URLRequestContextGetter> context_getter_; |
std::string server_url_; |
}; |