| Index: content/browser/devtools/devtools_http_handler_unittest.cc
|
| diff --git a/content/browser/devtools/devtools_http_handler_unittest.cc b/content/browser/devtools/devtools_http_handler_unittest.cc
|
| index 77e93614c3cade9421c9cc1ea94aecbac8159aa1..e8c1e646a04fc821abeb36e009eb3318d05845ea 100644
|
| --- a/content/browser/devtools/devtools_http_handler_unittest.cc
|
| +++ b/content/browser/devtools/devtools_http_handler_unittest.cc
|
| @@ -8,49 +8,53 @@
|
| #include "content/public/browser/devtools_http_handler.h"
|
| #include "content/public/browser/devtools_http_handler_delegate.h"
|
| #include "content/public/browser/devtools_target.h"
|
| -#include "net/socket/stream_listen_socket.h"
|
| +#include "net/base/net_errors.h"
|
| +#include "net/socket/server_socket.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace content {
|
| namespace {
|
|
|
| -using net::StreamListenSocket;
|
| -
|
| -class DummyListenSocket : public StreamListenSocket,
|
| - public StreamListenSocket::Delegate {
|
| +class DummyServerSocket : public net::ServerSocket {
|
| public:
|
| - DummyListenSocket()
|
| - : StreamListenSocket(net::kInvalidSocket, this) {}
|
| + DummyServerSocket() {}
|
|
|
| - // StreamListenSocket::Delegate "implementation"
|
| - virtual void DidAccept(StreamListenSocket* server,
|
| - scoped_ptr<StreamListenSocket> connection) OVERRIDE {}
|
| - virtual void DidRead(StreamListenSocket* connection,
|
| - const char* data,
|
| - int len) OVERRIDE {}
|
| - virtual void DidClose(StreamListenSocket* sock) OVERRIDE {}
|
| - protected:
|
| - virtual ~DummyListenSocket() {}
|
| - virtual void Accept() OVERRIDE {}
|
| + // net::ServerSocket "implementation"
|
| + virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE {
|
| + return net::OK;
|
| + }
|
| + virtual int ListenWithAddressAndPort(const std::string& ip_address,
|
| + int port,
|
| + int backlog) OVERRIDE {
|
| + return net::OK;
|
| + }
|
| + virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE {
|
| + return net::ERR_NOT_IMPLEMENTED;
|
| + }
|
| + virtual int Accept(scoped_ptr<net::StreamSocket>* socket,
|
| + const net::CompletionCallback& callback) OVERRIDE {
|
| + return net::ERR_IO_PENDING;
|
| + }
|
| };
|
|
|
| -class DummyListenSocketFactory : public net::StreamListenSocketFactory {
|
| +class DummyServerSocketFactory
|
| + : public DevToolsHttpHandler::ServerSocketFactory {
|
| public:
|
| - DummyListenSocketFactory(
|
| - base::Closure quit_closure_1, base::Closure quit_closure_2)
|
| - : quit_closure_1_(quit_closure_1), quit_closure_2_(quit_closure_2) {}
|
| - virtual ~DummyListenSocketFactory() {
|
| + DummyServerSocketFactory(base::Closure quit_closure_1,
|
| + base::Closure quit_closure_2)
|
| + : DevToolsHttpHandler::ServerSocketFactory("", 0, 0),
|
| + quit_closure_1_(quit_closure_1),
|
| + quit_closure_2_(quit_closure_2) {}
|
| + virtual ~DummyServerSocketFactory() {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE, quit_closure_2_);
|
| }
|
| -
|
| - virtual scoped_ptr<StreamListenSocket> CreateAndListen(
|
| - StreamListenSocket::Delegate* delegate) const OVERRIDE {
|
| + private:
|
| + virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE, quit_closure_1_);
|
| - return scoped_ptr<net::StreamListenSocket>(new DummyListenSocket());
|
| + return scoped_ptr<net::ServerSocket>(new DummyServerSocket());
|
| }
|
| - private:
|
| base::Closure quit_closure_1_;
|
| base::Closure quit_closure_2_;
|
| };
|
| @@ -72,8 +76,8 @@ class DummyDelegate : public DevToolsHttpHandlerDelegate {
|
| callback.Run(TargetList());
|
| }
|
| virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
|
| - net::StreamListenSocket::Delegate* delegate,
|
| - std::string* name) OVERRIDE {
|
| + net::StreamListenSocket::Delegate* delegate,
|
| + std::string* name) OVERRIDE {
|
| return scoped_ptr<net::StreamListenSocket>();
|
| }
|
| };
|
| @@ -101,13 +105,14 @@ class DevToolsHttpHandlerTest : public testing::Test {
|
|
|
| TEST_F(DevToolsHttpHandlerTest, TestStartStop) {
|
| base::RunLoop run_loop, run_loop_2;
|
| + scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory(
|
| + new DummyServerSocketFactory(run_loop.QuitClosure(),
|
| + run_loop_2.QuitClosure()));
|
| content::DevToolsHttpHandler* devtools_http_handler_ =
|
| - content::DevToolsHttpHandler::Start(
|
| - new DummyListenSocketFactory(run_loop.QuitClosure(),
|
| - run_loop_2.QuitClosure()),
|
| - std::string(),
|
| - new DummyDelegate(),
|
| - base::FilePath());
|
| + content::DevToolsHttpHandler::Start(factory.Pass(),
|
| + std::string(),
|
| + new DummyDelegate(),
|
| + base::FilePath());
|
| // Our dummy socket factory will post a quit message once the server will
|
| // become ready.
|
| run_loop.Run();
|
|
|