OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> |
| 6 |
5 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
7 #include "base/location.h" | 9 #include "base/location.h" |
8 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
11 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
12 #include "base/values.h" | 14 #include "base/values.h" |
13 #include "components/devtools_http_handler/devtools_http_handler.h" | 15 #include "components/devtools_http_handler/devtools_http_handler.h" |
14 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" | 16 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
17 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
18 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
19 #include "net/socket/server_socket.h" | 21 #include "net/socket/server_socket.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 | 23 |
22 using content::BrowserThread; | 24 using content::BrowserThread; |
23 | 25 |
24 namespace devtools_http_handler { | 26 namespace devtools_http_handler { |
25 namespace { | 27 namespace { |
26 | 28 |
27 const uint16 kDummyPort = 4321; | 29 const uint16_t kDummyPort = 4321; |
28 const base::FilePath::CharType kDevToolsActivePortFileName[] = | 30 const base::FilePath::CharType kDevToolsActivePortFileName[] = |
29 FILE_PATH_LITERAL("DevToolsActivePort"); | 31 FILE_PATH_LITERAL("DevToolsActivePort"); |
30 | 32 |
31 class DummyServerSocket : public net::ServerSocket { | 33 class DummyServerSocket : public net::ServerSocket { |
32 public: | 34 public: |
33 DummyServerSocket() {} | 35 DummyServerSocket() {} |
34 | 36 |
35 // net::ServerSocket "implementation" | 37 // net::ServerSocket "implementation" |
36 int Listen(const net::IPEndPoint& address, int backlog) override { | 38 int Listen(const net::IPEndPoint& address, int backlog) override { |
37 return net::OK; | 39 return net::OK; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 kDevToolsActivePortFileName); | 198 kDevToolsActivePortFileName); |
197 EXPECT_TRUE(base::PathExists(active_port_file)); | 199 EXPECT_TRUE(base::PathExists(active_port_file)); |
198 std::string file_contents; | 200 std::string file_contents; |
199 EXPECT_TRUE(base::ReadFileToString(active_port_file, &file_contents)); | 201 EXPECT_TRUE(base::ReadFileToString(active_port_file, &file_contents)); |
200 int port = 0; | 202 int port = 0; |
201 EXPECT_TRUE(base::StringToInt(file_contents, &port)); | 203 EXPECT_TRUE(base::StringToInt(file_contents, &port)); |
202 EXPECT_EQ(static_cast<int>(kDummyPort), port); | 204 EXPECT_EQ(static_cast<int>(kDummyPort), port); |
203 } | 205 } |
204 | 206 |
205 } // namespace devtools_http_handler | 207 } // namespace devtools_http_handler |
OLD | NEW |