| 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/spawner_communicator.h" | 5 #include "net/test/spawned_test_server/spawner_communicator.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 buf_(new IOBuffer(kBufferSize)), | 40 buf_(new IOBuffer(kBufferSize)), |
| 41 result_code_(result_code), | 41 result_code_(result_code), |
| 42 data_received_(data_received), | 42 data_received_(data_received), |
| 43 response_started_count_(0) { | 43 response_started_count_(0) { |
| 44 DCHECK(result_code); | 44 DCHECK(result_code); |
| 45 *result_code_ = OK; | 45 *result_code_ = OK; |
| 46 DCHECK(data_received); | 46 DCHECK(data_received); |
| 47 data_received_->clear(); | 47 data_received_->clear(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual ~SpawnerRequestData() {} | 50 ~SpawnerRequestData() override {} |
| 51 | 51 |
| 52 bool DoesRequestIdMatch(int request_id) const { | 52 bool DoesRequestIdMatch(int request_id) const { |
| 53 return request_id_ == request_id; | 53 return request_id_ == request_id; |
| 54 } | 54 } |
| 55 | 55 |
| 56 IOBuffer* buf() const { return buf_.get(); } | 56 IOBuffer* buf() const { return buf_.get(); } |
| 57 | 57 |
| 58 bool IsResultOK() const { return *result_code_ == OK; } | 58 bool IsResultOK() const { return *result_code_ == OK; } |
| 59 | 59 |
| 60 void ClearReceivedData() { data_received_->clear(); } | 60 void ClearReceivedData() { data_received_->clear(); } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 std::string server_return_data; | 371 std::string server_return_data; |
| 372 int result_code; | 372 int result_code; |
| 373 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); | 373 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); |
| 374 Shutdown(); | 374 Shutdown(); |
| 375 if (OK != result_code || server_return_data != "killed") | 375 if (OK != result_code || server_return_data != "killed") |
| 376 return false; | 376 return false; |
| 377 return true; | 377 return true; |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace net | 380 } // namespace net |
| OLD | NEW |