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

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

Issue 296053012: Replace StreamListenSocket with StreamSocket in HttpServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
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..753b115c0fdc22cc3a356d32f6ed7b026a4f18d6 100644
--- a/chrome/test/chromedriver/net/net_util_unittest.cc
+++ b/chrome/test/chromedriver/net/net_util_unittest.cc
@@ -20,7 +20,6 @@
#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/url_request/url_request_context_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -54,8 +53,8 @@ class FetchUrlTest : public testing::Test,
}
void InitOnIO(base::WaitableEvent* event) {
- net::TCPListenSocketFactory factory("127.0.0.1", 0);
- server_ = new net::HttpServer(factory, this);
+ server_.reset(net::HttpServer::Create("127.0.0.1", 0, this));
+ DCHECK(server_);
net::IPEndPoint address;
CHECK_EQ(net::OK, server_->GetLocalAddress(&address));
server_url_ = base::StringPrintf("http://127.0.0.1:%d", address.port());
@@ -63,7 +62,7 @@ class FetchUrlTest : public testing::Test,
}
void DestroyServerOnIO(base::WaitableEvent* event) {
- server_ = NULL;
+ server_.reset(NULL);
event->Signal();
}
@@ -81,7 +80,8 @@ class FetchUrlTest : public testing::Test,
// 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));
+ base::Bind(&net::HttpServer::Close, server_->AsWeakPtr(),
+ connection_id));
break;
default:
break;
@@ -104,7 +104,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_;
};

Powered by Google App Engine
This is Rietveld 408576698