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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DISALLOW_COPY_AND_ASSIGN(SpawnerRequestData); | 96 DISALLOW_COPY_AND_ASSIGN(SpawnerRequestData); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 SpawnerCommunicator::SpawnerCommunicator(uint16 port) | 101 SpawnerCommunicator::SpawnerCommunicator(uint16 port) |
102 : io_thread_("spawner_communicator"), | 102 : io_thread_("spawner_communicator"), |
103 event_(false, false), | 103 event_(false, false), |
104 port_(port), | 104 port_(port), |
105 next_id_(0), | 105 next_id_(0), |
106 weak_factory_(this), | 106 is_running_(false), |
107 is_running_(false) {} | 107 weak_factory_(this) {} |
108 | 108 |
109 SpawnerCommunicator::~SpawnerCommunicator() { | 109 SpawnerCommunicator::~SpawnerCommunicator() { |
110 DCHECK(!is_running_); | 110 DCHECK(!is_running_); |
111 } | 111 } |
112 | 112 |
113 void SpawnerCommunicator::WaitForResponse() { | 113 void SpawnerCommunicator::WaitForResponse() { |
114 DCHECK_NE(base::MessageLoop::current(), io_thread_.message_loop()); | 114 DCHECK_NE(base::MessageLoop::current(), io_thread_.message_loop()); |
115 event_.Wait(); | 115 event_.Wait(); |
116 event_.Reset(); | 116 event_.Reset(); |
117 } | 117 } |
(...skipping 253 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 |