Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/test/sync/test_http_bridge_factory.h

Issue 6523032: Even more test cleanup. Some fixes to non-test code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698