Index: sync/test/fake_server/fake_server_http_post_provider.h |
diff --git a/sync/test/fake_server/fake_server_http_post_provider.h b/sync/test/fake_server/fake_server_http_post_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..037f25e352588904665f9cdb0a625e504ecc61aa |
--- /dev/null |
+++ b/sync/test/fake_server/fake_server_http_post_provider.h |
@@ -0,0 +1,71 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ |
+#define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "sync/internal_api/public/http_post_provider_factory.h" |
+#include "sync/internal_api/public/http_post_provider_interface.h" |
+ |
+namespace syncer { |
+ |
+class FakeServer; |
+ |
+class FakeServerHttpPostProvider |
+ : public HttpPostProviderInterface, |
+ public base::RefCountedThreadSafe<FakeServerHttpPostProvider> { |
+ public: |
+ FakeServerHttpPostProvider(FakeServer* fake_server); |
+ |
+ // HttpPostProviderInterface implementation. |
+ virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE; |
+ virtual void SetURL(const char* url, int port) OVERRIDE; |
+ virtual void SetPostPayload(const char* content_type, int content_length, |
+ const char* content) OVERRIDE; |
+ virtual bool MakeSynchronousPost(int* error_code, |
+ int* response_code) OVERRIDE; |
+ virtual void Abort() OVERRIDE; |
+ virtual int GetResponseContentLength() const OVERRIDE; |
+ virtual const char* GetResponseContent() const OVERRIDE; |
+ virtual const std::string GetResponseHeaderValue( |
+ const std::string& name) const OVERRIDE; |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<FakeServerHttpPostProvider>; |
+ virtual ~FakeServerHttpPostProvider(); |
+ |
+ private: |
+ FakeServer* const fake_server_; |
+ std::string response_; |
+ std::string request_url_; |
+ int request_port_; |
+ std::string request_content_; |
+ std::string request_content_type_; |
+ std::string extra_request_headers_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FakeServerHttpPostProvider); |
+}; |
+ |
+class FakeServerHttpPostProviderFactory : public HttpPostProviderFactory { |
+ public: |
+ FakeServerHttpPostProviderFactory(FakeServer* fake_server); |
+ virtual ~FakeServerHttpPostProviderFactory(); |
+ |
+ // HttpPostProviderFactory: |
+ virtual void Init(const std::string& user_agent) OVERRIDE; |
+ virtual HttpPostProviderInterface* Create() OVERRIDE; |
+ virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE; |
+ |
+ private: |
+ FakeServer* const fake_server_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FakeServerHttpPostProviderFactory); |
+}; |
+ |
+} // namespace syncer |
+ |
+#endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ |