| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test_server.h" | 5 #include "net/test/test_server.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 DWORD bytes_max, uint8* buffer) { | 45 DWORD bytes_max, uint8* buffer) { |
| 46 base::Thread thread("test_server_watcher"); | 46 base::Thread thread("test_server_watcher"); |
| 47 if (!thread.Start()) | 47 if (!thread.Start()) |
| 48 return false; | 48 return false; |
| 49 | 49 |
| 50 // Prepare a timeout in case the server fails to start. | 50 // Prepare a timeout in case the server fails to start. |
| 51 bool unblocked = false; | 51 bool unblocked = false; |
| 52 thread.message_loop()->PostDelayedTask( | 52 thread.message_loop()->PostDelayedTask( |
| 53 FROM_HERE, | 53 FROM_HERE, |
| 54 NewRunnableFunction(UnblockPipe, write_fd, bytes_max, &unblocked), | 54 NewRunnableFunction(UnblockPipe, write_fd, bytes_max, &unblocked), |
| 55 TestTimeouts::action_max_timeout_ms()); | 55 TestTimeouts::action_timeout_ms()); |
| 56 | 56 |
| 57 DWORD bytes_read = 0; | 57 DWORD bytes_read = 0; |
| 58 while (bytes_read < bytes_max) { | 58 while (bytes_read < bytes_max) { |
| 59 DWORD num_bytes; | 59 DWORD num_bytes; |
| 60 if (!ReadFile(read_fd, buffer + bytes_read, bytes_max - bytes_read, | 60 if (!ReadFile(read_fd, buffer + bytes_read, bytes_max - bytes_read, |
| 61 &num_bytes, NULL)) { | 61 &num_bytes, NULL)) { |
| 62 PLOG(ERROR) << "ReadFile failed"; | 62 PLOG(ERROR) << "ReadFile failed"; |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| 65 if (num_bytes <= 0) { | 65 if (num_bytes <= 0) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 if (!ParseServerData(server_data)) { | 173 if (!ParseServerData(server_data)) { |
| 174 LOG(ERROR) << "Could not parse server_data: " << server_data; | 174 LOG(ERROR) << "Could not parse server_data: " << server_data; |
| 175 return false; | 175 return false; |
| 176 } | 176 } |
| 177 | 177 |
| 178 return true; | 178 return true; |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace net | 181 } // namespace net |
| OLD | NEW |