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

Unified Diff: chrome/test/chromedriver/net/net_util_unittest.cc

Issue 487013003: Revert "Revert of Replace StreamListenSocket with StreamSocket in HttpServer. (patchset #29 of http… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years, 4 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 | « chrome/browser/devtools/remote_debugging_server.cc ('k') | chrome/test/chromedriver/net/test_http_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « chrome/browser/devtools/remote_debugging_server.cc ('k') | chrome/test/chromedriver/net/test_http_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698