OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/test/fake_server/fake_server_http_post_provider.h" | 5 #include "sync/test/fake_server/fake_server_http_post_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 request_content_.assign(content, content_length); | 68 request_content_.assign(content, content_length); |
69 } | 69 } |
70 | 70 |
71 bool FakeServerHttpPostProvider::MakeSynchronousPost(int* error_code, | 71 bool FakeServerHttpPostProvider::MakeSynchronousPost(int* error_code, |
72 int* response_code) { | 72 int* response_code) { |
73 // It is assumed that a POST is being made to /command. | 73 // It is assumed that a POST is being made to /command. |
74 int post_error_code = -1; | 74 int post_error_code = -1; |
75 int post_response_code = -1; | 75 int post_response_code = -1; |
76 std::string post_response; | 76 std::string post_response; |
77 | 77 |
78 base::WaitableEvent post_complete(false, false); | 78 base::WaitableEvent post_complete( |
| 79 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 80 base::WaitableEvent::InitialState::NOT_SIGNALED); |
79 base::Closure signal_closure = base::Bind(&base::WaitableEvent::Signal, | 81 base::Closure signal_closure = base::Bind(&base::WaitableEvent::Signal, |
80 base::Unretained(&post_complete)); | 82 base::Unretained(&post_complete)); |
81 | 83 |
82 bool result = fake_server_task_runner_->PostTask( | 84 bool result = fake_server_task_runner_->PostTask( |
83 FROM_HERE, | 85 FROM_HERE, |
84 base::Bind(&FakeServer::HandleCommand, | 86 base::Bind(&FakeServer::HandleCommand, |
85 fake_server_, | 87 fake_server_, |
86 base::ConstRef(request_content_), | 88 base::ConstRef(request_content_), |
87 base::ConstRef(signal_closure), | 89 base::ConstRef(signal_closure), |
88 &post_error_code, | 90 &post_error_code, |
(...skipping 23 matching lines...) Expand all Loading... |
112 | 114 |
113 const std::string FakeServerHttpPostProvider::GetResponseHeaderValue( | 115 const std::string FakeServerHttpPostProvider::GetResponseHeaderValue( |
114 const std::string& name) const { | 116 const std::string& name) const { |
115 return std::string(); | 117 return std::string(); |
116 } | 118 } |
117 | 119 |
118 void FakeServerHttpPostProvider::Abort() { | 120 void FakeServerHttpPostProvider::Abort() { |
119 } | 121 } |
120 | 122 |
121 } // namespace fake_server | 123 } // namespace fake_server |
OLD | NEW |