| 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 <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // sending a command to spawner server. | 97 // sending a command to spawner server. |
| 98 int response_started_count_; | 98 int response_started_count_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(SpawnerRequestData); | 100 DISALLOW_COPY_AND_ASSIGN(SpawnerRequestData); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } // namespace | 103 } // namespace |
| 104 | 104 |
| 105 SpawnerCommunicator::SpawnerCommunicator(uint16_t port) | 105 SpawnerCommunicator::SpawnerCommunicator(uint16_t port) |
| 106 : io_thread_("spawner_communicator"), | 106 : io_thread_("spawner_communicator"), |
| 107 event_(false, false), | 107 event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 108 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 108 port_(port), | 109 port_(port), |
| 109 next_id_(0), | 110 next_id_(0), |
| 110 is_running_(false), | 111 is_running_(false), |
| 111 weak_factory_(this) {} | 112 weak_factory_(this) {} |
| 112 | 113 |
| 113 SpawnerCommunicator::~SpawnerCommunicator() { | 114 SpawnerCommunicator::~SpawnerCommunicator() { |
| 114 DCHECK(!is_running_); | 115 DCHECK(!is_running_); |
| 115 } | 116 } |
| 116 | 117 |
| 117 void SpawnerCommunicator::WaitForResponse() { | 118 void SpawnerCommunicator::WaitForResponse() { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 std::string server_return_data; | 377 std::string server_return_data; |
| 377 int result_code; | 378 int result_code; |
| 378 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); | 379 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); |
| 379 Shutdown(); | 380 Shutdown(); |
| 380 if (OK != result_code || server_return_data != "killed") | 381 if (OK != result_code || server_return_data != "killed") |
| 381 return false; | 382 return false; |
| 382 return true; | 383 return true; |
| 383 } | 384 } |
| 384 | 385 |
| 385 } // namespace net | 386 } // namespace net |
| OLD | NEW |