| 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 "content/browser/devtools/devtools_http_handler.h" | 5 #include "content/browser/devtools/devtools_http_handler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 DevToolsAgentHost::StopRemoteDebuggingServer(); | 144 DevToolsAgentHost::StopRemoteDebuggingServer(); |
| 145 // Make sure the handler actually stops. | 145 // Make sure the handler actually stops. |
| 146 run_loop_2.Run(); | 146 run_loop_2.Run(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 TEST_F(DevToolsHttpHandlerTest, TestServerSocketFailed) { | 149 TEST_F(DevToolsHttpHandlerTest, TestServerSocketFailed) { |
| 150 base::RunLoop run_loop, run_loop_2; | 150 base::RunLoop run_loop, run_loop_2; |
| 151 std::unique_ptr<DevToolsSocketFactory> factory( | 151 std::unique_ptr<DevToolsSocketFactory> factory( |
| 152 new FailingServerSocketFactory(run_loop.QuitClosure(), | 152 new FailingServerSocketFactory(run_loop.QuitClosure(), |
| 153 run_loop_2.QuitClosure())); | 153 run_loop_2.QuitClosure())); |
| 154 LOG(INFO) << "Following error message is expected:"; |
| 154 DevToolsAgentHost::StartRemoteDebuggingServer( | 155 DevToolsAgentHost::StartRemoteDebuggingServer( |
| 155 std::move(factory), std::string(), base::FilePath(), base::FilePath(), | 156 std::move(factory), std::string(), base::FilePath(), base::FilePath(), |
| 156 std::string(), std::string()); | 157 std::string(), std::string()); |
| 157 // Our dummy socket factory will post a quit message once the server will | 158 // Our dummy socket factory will post a quit message once the server will |
| 158 // become ready. | 159 // become ready. |
| 159 run_loop.Run(); | 160 run_loop.Run(); |
| 160 for (int i = 0; i < 5; i++) { | 161 for (int i = 0; i < 5; i++) { |
| 161 RunAllPendingInMessageLoop(BrowserThread::UI); | 162 RunAllPendingInMessageLoop(BrowserThread::UI); |
| 162 RunAllPendingInMessageLoop(BrowserThread::FILE); | 163 RunAllPendingInMessageLoop(BrowserThread::FILE); |
| 163 } | 164 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 191 temp_dir.GetPath().Append(kDevToolsActivePortFileName); | 192 temp_dir.GetPath().Append(kDevToolsActivePortFileName); |
| 192 EXPECT_TRUE(base::PathExists(active_port_file)); | 193 EXPECT_TRUE(base::PathExists(active_port_file)); |
| 193 std::string file_contents; | 194 std::string file_contents; |
| 194 EXPECT_TRUE(base::ReadFileToString(active_port_file, &file_contents)); | 195 EXPECT_TRUE(base::ReadFileToString(active_port_file, &file_contents)); |
| 195 int port = 0; | 196 int port = 0; |
| 196 EXPECT_TRUE(base::StringToInt(file_contents, &port)); | 197 EXPECT_TRUE(base::StringToInt(file_contents, &port)); |
| 197 EXPECT_EQ(static_cast<int>(kDummyPort), port); | 198 EXPECT_EQ(static_cast<int>(kDummyPort), port); |
| 198 } | 199 } |
| 199 | 200 |
| 200 } // namespace content | 201 } // namespace content |
| OLD | NEW |