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

Unified Diff: net/test/spawned_test_server/local_test_server_win.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/test/spawned_test_server/local_test_server_win.cc
diff --git a/net/test/spawned_test_server/local_test_server_win.cc b/net/test/spawned_test_server/local_test_server_win.cc
index 726a5810c0dbb06f99c018a4b1de1e8ccdd4918d..8e1c25438eeca0d9f77283ded7777a98e6907c0e 100644
--- a/net/test/spawned_test_server/local_test_server_win.cc
+++ b/net/test/spawned_test_server/local_test_server_win.cc
@@ -34,10 +34,9 @@ void UnblockPipe(HANDLE handle, DWORD size, bool* unblocked) {
// Unblock the ReadFile in LocalTestServer::WaitToStart by writing to the
// pipe. Make sure the call succeeded, otherwise we are very likely to hang.
DWORD bytes_written = 0;
- LOG(WARNING) << "Timeout reached; unblocking pipe by writing "
- << size << " bytes";
- CHECK(WriteFile(handle, unblock_data.data(), size, &bytes_written,
- NULL));
+ LOG(WARNING) << "Timeout reached; unblocking pipe by writing " << size
+ << " bytes";
+ CHECK(WriteFile(handle, unblock_data.data(), size, &bytes_written, NULL));
CHECK_EQ(size, bytes_written);
*unblocked = true;
}
@@ -45,8 +44,7 @@ void UnblockPipe(HANDLE handle, DWORD size, bool* unblocked) {
// Given a file handle, reads into |buffer| until |bytes_max| bytes
// has been read or an error has been encountered. Returns
// true if the read was successful.
-bool ReadData(HANDLE read_fd, HANDLE write_fd,
- DWORD bytes_max, uint8* buffer) {
+bool ReadData(HANDLE read_fd, HANDLE write_fd, DWORD bytes_max, uint8* buffer) {
base::Thread thread("test_server_watcher");
if (!thread.Start())
return false;
@@ -54,14 +52,18 @@ bool ReadData(HANDLE read_fd, HANDLE write_fd,
// Prepare a timeout in case the server fails to start.
bool unblocked = false;
thread.message_loop()->PostDelayedTask(
- FROM_HERE, base::Bind(UnblockPipe, write_fd, bytes_max, &unblocked),
+ FROM_HERE,
+ base::Bind(UnblockPipe, write_fd, bytes_max, &unblocked),
TestTimeouts::action_max_timeout());
DWORD bytes_read = 0;
while (bytes_read < bytes_max) {
DWORD num_bytes;
- if (!ReadFile(read_fd, buffer + bytes_read, bytes_max - bytes_read,
- &num_bytes, NULL)) {
+ if (!ReadFile(read_fd,
+ buffer + bytes_read,
+ bytes_max - bytes_read,
+ &num_bytes,
+ NULL)) {
PLOG(ERROR) << "ReadFile failed";
return false;
}
@@ -114,8 +116,7 @@ class ScopedPath {
};
ScopedPath::ScopedPath(const base::FilePath& path_to_add)
- : environment_(base::Environment::Create()),
- path_modified_(false) {
+ : environment_(base::Environment::Create()), path_modified_(false) {
environment_->GetVar("PATH", &old_path_);
std::string new_value = old_path_;
@@ -159,8 +160,8 @@ bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) {
child_write_fd_.Set(child_write);
// Have the child inherit the write half.
- if (!SetHandleInformation(child_write, HANDLE_FLAG_INHERIT,
- HANDLE_FLAG_INHERIT)) {
+ if (!SetHandleInformation(
+ child_write, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
PLOG(ERROR) << "Failed to enable pipe inheritance";
return false;
}
@@ -175,7 +176,8 @@ bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) {
// safe to truncate the handle (when passing it from 64-bit to
// 32-bit) or sign-extend the handle (when passing it from 32-bit to
// 64-bit)."
- python_command.AppendArg("--startup-pipe=" +
+ python_command.AppendArg(
+ "--startup-pipe=" +
base::IntToString(reinterpret_cast<uintptr_t>(child_write)));
job_handle_.Set(CreateJobObject(NULL, NULL));
@@ -206,13 +208,17 @@ bool LocalTestServer::WaitToStart() {
base::win::ScopedHandle write_fd(child_write_fd_.Take());
uint32 server_data_len = 0;
- if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(server_data_len),
+ if (!ReadData(read_fd.Get(),
+ write_fd.Get(),
+ sizeof(server_data_len),
reinterpret_cast<uint8*>(&server_data_len))) {
LOG(ERROR) << "Could not read server_data_len";
return false;
}
std::string server_data(server_data_len, '\0');
- if (!ReadData(read_fd.Get(), write_fd.Get(), server_data_len,
+ if (!ReadData(read_fd.Get(),
+ write_fd.Get(),
+ server_data_len,
reinterpret_cast<uint8*>(&server_data[0]))) {
LOG(ERROR) << "Could not read server_data (" << server_data_len
<< " bytes)";
@@ -228,4 +234,3 @@ bool LocalTestServer::WaitToStart() {
}
} // namespace net
-

Powered by Google App Engine
This is Rietveld 408576698