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

Side by Side Diff: chrome/browser/devtools/device/adb/mock_adb_server.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/devtools/device/adb/mock_adb_server.h" 5 #include "chrome/browser/devtools/device/adb/mock_adb_server.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/threading/non_thread_safe.h" 19 #include "base/threading/non_thread_safe.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/test/browser_test.h" 22 #include "content/public/test/browser_test.h"
23 #include "content/public/test/test_utils.h" 23 #include "content/public/test/test_utils.h"
24 #include "net/base/io_buffer.h" 24 #include "net/base/io_buffer.h"
25 #include "net/base/ip_address.h" 25 #include "net/base/ip_address.h"
26 #include "net/base/ip_endpoint.h" 26 #include "net/base/ip_endpoint.h"
27 #include "net/base/net_errors.h" 27 #include "net/base/net_errors.h"
28 #include "net/log/net_log_source.h"
28 #include "net/socket/stream_socket.h" 29 #include "net/socket/stream_socket.h"
29 #include "net/socket/tcp_server_socket.h" 30 #include "net/socket/tcp_server_socket.h"
30 31
31 using content::BrowserThread; 32 using content::BrowserThread;
32 33
33 namespace { 34 namespace {
34 35
35 const char kHostTransportPrefix[] = "host:transport:"; 36 const char kHostTransportPrefix[] = "host:transport:";
36 const char kLocalAbstractPrefix[] = "localabstract:"; 37 const char kLocalAbstractPrefix[] = "localabstract:";
37 38
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 std::unique_ptr<net::TCPServerSocket> socket_; 225 std::unique_ptr<net::TCPServerSocket> socket_;
225 std::unique_ptr<net::StreamSocket> client_socket_; 226 std::unique_ptr<net::StreamSocket> client_socket_;
226 base::WeakPtrFactory<SimpleHttpServer> weak_factory_; 227 base::WeakPtrFactory<SimpleHttpServer> weak_factory_;
227 228
228 DISALLOW_COPY_AND_ASSIGN(SimpleHttpServer); 229 DISALLOW_COPY_AND_ASSIGN(SimpleHttpServer);
229 }; 230 };
230 231
231 SimpleHttpServer::SimpleHttpServer(const ParserFactory& factory, 232 SimpleHttpServer::SimpleHttpServer(const ParserFactory& factory,
232 net::IPEndPoint endpoint) 233 net::IPEndPoint endpoint)
233 : factory_(factory), 234 : factory_(factory),
234 socket_(new net::TCPServerSocket(nullptr, net::NetLog::Source())), 235 socket_(new net::TCPServerSocket(nullptr, net::NetLogSource())),
235 weak_factory_(this) { 236 weak_factory_(this) {
236 socket_->Listen(endpoint, 5); 237 socket_->Listen(endpoint, 5);
237 OnConnect(); 238 OnConnect();
238 } 239 }
239 240
240 SimpleHttpServer::~SimpleHttpServer() { 241 SimpleHttpServer::~SimpleHttpServer() {
241 } 242 }
242 243
243 SimpleHttpServer::Connection::Connection(net::StreamSocket* socket, 244 SimpleHttpServer::Connection::Connection(net::StreamSocket* socket,
244 const ParserFactory& factory) 245 const ParserFactory& factory)
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 content::RunMessageLoop(); 614 content::RunMessageLoop();
614 } 615 }
615 616
616 void StopMockAdbServer() { 617 void StopMockAdbServer() {
617 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, 618 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE,
618 base::Bind(&StopMockAdbServerOnIOThread), 619 base::Bind(&StopMockAdbServerOnIOThread),
619 base::MessageLoop::QuitWhenIdleClosure()); 620 base::MessageLoop::QuitWhenIdleClosure());
620 content::RunMessageLoop(); 621 content::RunMessageLoop();
621 } 622 }
622 623
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698