OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_TEST_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ | 5 #ifndef CHROME_TEST_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ |
6 #define CHROME_TEST_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ | 6 #define CHROME_TEST_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/sync/engine/syncapi.h" | 9 #include "chrome/browser/sync/engine/syncapi.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 // Set the type, length and content of the POST payload. | 23 // Set the type, length and content of the POST payload. |
24 // |content_type| is a null-terminated MIME type specifier. | 24 // |content_type| is a null-terminated MIME type specifier. |
25 // |content| is a data buffer; Do not interpret as a null-terminated string. | 25 // |content| is a data buffer; Do not interpret as a null-terminated string. |
26 // |content_length| is the total number of chars in |content|. It is used to | 26 // |content_length| is the total number of chars in |content|. It is used to |
27 // assign/copy |content| data. | 27 // assign/copy |content| data. |
28 virtual void SetPostPayload(const char* content_type, int content_length, | 28 virtual void SetPostPayload(const char* content_type, int content_length, |
29 const char* content) {} | 29 const char* content) {} |
30 | 30 |
31 // Returns true if the URL request succeeded. If the request failed, | 31 // Returns true if the URL request succeeded. If the request failed, |
32 // os_error() may be non-zero and hence contain more information. | 32 // os_error() may be non-zero and hence contain more information. |
33 virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) { | 33 virtual bool MakeSynchronousPost(int* os_error_code, int* response_code); |
34 return false; | |
35 } | |
36 | 34 |
37 // Get the length of the content returned in the HTTP response. | 35 // Get the length of the content returned in the HTTP response. |
38 // This does not count the trailing null-terminating character returned | 36 // This does not count the trailing null-terminating character returned |
39 // by GetResponseContent, so it is analogous to calling string.length. | 37 // by GetResponseContent, so it is analogous to calling string.length. |
40 virtual int GetResponseContentLength() const { | 38 virtual int GetResponseContentLength() const; |
41 return 0; | |
42 } | |
43 | 39 |
44 // Get the content returned in the HTTP response. | 40 // Get the content returned in the HTTP response. |
45 // This is a null terminated string of characters. | 41 // This is a null terminated string of characters. |
46 // Value should be copied. | 42 // Value should be copied. |
47 virtual const char* GetResponseContent() const { | 43 virtual const char* GetResponseContent() const; |
48 return 0; | |
49 } | |
50 | 44 |
51 virtual const std::string GetResponseHeaderValue(const std::string &) const { | 45 virtual const std::string GetResponseHeaderValue(const std::string &) const; |
Nico
2011/02/15 21:25:37
i guess this should be std::string&?
Elliot Glaysher
2011/02/15 22:09:51
Can't; this function is defined by the protobufs a
| |
52 return std::string(); | |
53 } | |
54 }; | 46 }; |
55 | 47 |
56 class TestHttpBridgeFactory : public sync_api::HttpPostProviderFactory { | 48 class TestHttpBridgeFactory : public sync_api::HttpPostProviderFactory { |
57 public: | 49 public: |
58 // Override everything to do nothing. | 50 // Override everything to do nothing. |
59 TestHttpBridgeFactory() {} | 51 TestHttpBridgeFactory(); |
60 ~TestHttpBridgeFactory() {} | 52 virtual ~TestHttpBridgeFactory(); |
61 | 53 |
62 virtual sync_api::HttpPostProviderInterface* Create() { | 54 // sync_api::HttpPostProviderFactory: |
63 return new TestHttpBridge(); | 55 virtual sync_api::HttpPostProviderInterface* Create(); |
64 } | 56 virtual void Destroy(sync_api::HttpPostProviderInterface* http); |
65 virtual void Destroy(sync_api::HttpPostProviderInterface* http) { | |
66 delete http; | |
67 } | |
68 }; | 57 }; |
69 | 58 |
70 } // namespace browser_sync | 59 } // namespace browser_sync |
71 | 60 |
72 #endif // CHROME_TEST_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ | 61 #endif // CHROME_TEST_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ |
OLD | NEW |