| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ |
| 7 |
| 8 #if defined(BROWSER_SYNC) |
| 9 |
| 10 #include "chrome/browser/sync/engine/syncapi.h" |
| 11 |
| 12 namespace browser_sync { |
| 13 |
| 14 class TestHttpBridge : public sync_api::HttpPostProviderInterface { |
| 15 public: |
| 16 virtual void SetUserAgent(const char* user_agent) {} |
| 17 |
| 18 // Add additional headers to the request. |
| 19 virtual void SetExtraRequestHeaders(const char * headers) {} |
| 20 |
| 21 // Set the URL to POST to. |
| 22 virtual void SetURL(const char* url, int port) {} |
| 23 |
| 24 // Set the type, length and content of the POST payload. |
| 25 // |content_type| is a null-terminated MIME type specifier. |
| 26 // |content| is a data buffer; Do not interpret as a null-terminated string. |
| 27 // |content_length| is the total number of chars in |content|. It is used to |
| 28 // assign/copy |content| data. |
| 29 virtual void SetPostPayload(const char* content_type, int content_length, |
| 30 const char* content) {} |
| 31 |
| 32 // Returns true if the URL request succeeded. If the request failed, |
| 33 // os_error() may be non-zero and hence contain more information. |
| 34 virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) { |
| 35 return false; |
| 36 } |
| 37 |
| 38 // Get the length of the content returned in the HTTP response. |
| 39 // This does not count the trailing null-terminating character returned |
| 40 // by GetResponseContent, so it is analogous to calling string.length. |
| 41 virtual int GetResponseContentLength() const { |
| 42 return 0; |
| 43 } |
| 44 |
| 45 // Get the content returned in the HTTP response. |
| 46 // This is a null terminated string of characters. |
| 47 // Value should be copied. |
| 48 virtual const char* GetResponseContent() const { |
| 49 return 0; |
| 50 } |
| 51 }; |
| 52 |
| 53 class TestHttpBridgeFactory : public sync_api::HttpPostProviderFactory { |
| 54 public: |
| 55 // Override everything to do nothing. |
| 56 TestHttpBridgeFactory() {} |
| 57 ~TestHttpBridgeFactory() {} |
| 58 |
| 59 virtual sync_api::HttpPostProviderInterface* Create() { |
| 60 return new TestHttpBridge(); |
| 61 } |
| 62 virtual void Destroy(sync_api::HttpPostProviderInterface* http) {} |
| 63 }; |
| 64 |
| 65 } // namespace browser_sync |
| 66 |
| 67 |
| 68 #endif // defined(BROWSER_SYNC) |
| 69 #endif // CHROME_BROWSER_SYNC_TEST_HTTP_BRIDGE_FACTORY_H_ |
| OLD | NEW |