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 "sync/internal_api/syncapi_server_connection_manager.h" | 5 #include "sync/internal_api/syncapi_server_connection_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 BlockingHttpPost() : wait_for_abort_(false, false) {} | 29 BlockingHttpPost() : wait_for_abort_(false, false) {} |
30 virtual ~BlockingHttpPost() {} | 30 virtual ~BlockingHttpPost() {} |
31 | 31 |
32 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} | 32 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} |
33 virtual void SetURL(const char* url, int port) OVERRIDE {} | 33 virtual void SetURL(const char* url, int port) OVERRIDE {} |
34 virtual void SetPostPayload(const char* content_type, | 34 virtual void SetPostPayload(const char* content_type, |
35 int content_length, | 35 int content_length, |
36 const char* content) OVERRIDE {} | 36 const char* content) OVERRIDE {} |
37 virtual bool MakeSynchronousPost(int* error_code, int* response_code) | 37 virtual bool MakeSynchronousPost(int* error_code, int* response_code) |
38 OVERRIDE { | 38 OVERRIDE { |
39 wait_for_abort_.TimedWait(TimeDelta::FromMilliseconds( | 39 wait_for_abort_.TimedWait(TestTimeouts::action_max_timeout()); |
40 TestTimeouts::action_max_timeout_ms())); | |
41 *error_code = net::ERR_ABORTED; | 40 *error_code = net::ERR_ABORTED; |
42 return false; | 41 return false; |
43 } | 42 } |
44 virtual int GetResponseContentLength() const OVERRIDE { | 43 virtual int GetResponseContentLength() const OVERRIDE { |
45 return 0; | 44 return 0; |
46 } | 45 } |
47 virtual const char* GetResponseContent() const OVERRIDE { | 46 virtual const char* GetResponseContent() const OVERRIDE { |
48 return ""; | 47 return ""; |
49 } | 48 } |
50 virtual const std::string GetResponseHeaderValue( | 49 virtual const std::string GetResponseHeaderValue( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool result = server.PostBufferToPath( | 104 bool result = server.PostBufferToPath( |
106 ¶ms, "/testpath", "testauth", &watcher); | 105 ¶ms, "/testpath", "testauth", &watcher); |
107 | 106 |
108 EXPECT_FALSE(result); | 107 EXPECT_FALSE(result); |
109 EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE, | 108 EXPECT_EQ(HttpResponse::CONNECTION_UNAVAILABLE, |
110 params.response.server_status); | 109 params.response.server_status); |
111 abort_thread.Stop(); | 110 abort_thread.Stop(); |
112 } | 111 } |
113 | 112 |
114 } // namespace syncer | 113 } // namespace syncer |
OLD | NEW |