Chromium Code Reviews| 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 "net/test/spawned_test_server/local_test_server.h" | 5 #include "net/test/spawned_test_server/local_test_server.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <wincrypt.h> | |
| 9 | 8 |
| 10 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 11 #include "base/bind.h" | 10 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 13 #include "base/environment.h" | 12 #include "base/environment.h" |
| 14 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 15 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 16 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 17 #include "base/process/launch.h" | 16 #include "base/process/launch.h" |
| 18 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/test/test_timeouts.h" | 20 #include "base/test/test_timeouts.h" |
| 22 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 23 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
| 24 #include "net/test/python_utils.h" | 23 #include "net/test/python_utils.h" |
| 25 | 24 |
| 26 #pragma comment(lib, "crypt32.lib") | |
|
Ryan Sleevi
2014/10/29 20:40:24
que?
davidben
2014/10/29 22:49:58
wincrypt does not appear to be used in this file.
| |
| 27 | |
| 28 namespace { | 25 namespace { |
| 29 | 26 |
| 30 // Writes |size| bytes to |handle| and sets |*unblocked| to true. | 27 // Writes |size| bytes to |handle| and sets |*unblocked| to true. |
| 31 // Used as a crude timeout mechanism by ReadData(). | 28 // Used as a crude timeout mechanism by ReadData(). |
| 32 void UnblockPipe(HANDLE handle, DWORD size, bool* unblocked) { | 29 void UnblockPipe(HANDLE handle, DWORD size, bool* unblocked) { |
| 33 std::string unblock_data(size, '\0'); | 30 std::string unblock_data(size, '\0'); |
| 34 // Unblock the ReadFile in LocalTestServer::WaitToStart by writing to the | 31 // Unblock the ReadFile in LocalTestServer::WaitToStart by writing to the |
| 35 // pipe. Make sure the call succeeded, otherwise we are very likely to hang. | 32 // pipe. Make sure the call succeeded, otherwise we are very likely to hang. |
| 36 DWORD bytes_written = 0; | 33 DWORD bytes_written = 0; |
| 37 LOG(WARNING) << "Timeout reached; unblocking pipe by writing " | 34 LOG(WARNING) << "Timeout reached; unblocking pipe by writing " |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 if (!ParseServerData(server_data)) { | 206 if (!ParseServerData(server_data)) { |
| 210 LOG(ERROR) << "Could not parse server_data: " << server_data; | 207 LOG(ERROR) << "Could not parse server_data: " << server_data; |
| 211 return false; | 208 return false; |
| 212 } | 209 } |
| 213 | 210 |
| 214 return true; | 211 return true; |
| 215 } | 212 } |
| 216 | 213 |
| 217 } // namespace net | 214 } // namespace net |
| 218 | 215 |
| OLD | NEW |