test_http_bridge_factory.h revision 58537e28ecd584eab876aee8be7156509866d23a
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_SYNC_TEST_TEST_HTTP_BRIDGE_FACTORY_H_
6#define CHROME_BROWSER_SYNC_TEST_TEST_HTTP_BRIDGE_FACTORY_H_
7
8#include "base/compiler_specific.h"
9#include "sync/internal_api/public/http_post_provider_factory.h"
10#include "sync/internal_api/public/http_post_provider_interface.h"
11
12namespace browser_sync {
13
14class TestHttpBridge : public syncer::HttpPostProviderInterface {
15 public:
16  // Begin syncer::HttpPostProviderInterface implementation:
17  virtual void SetExtraRequestHeaders(const char * headers) OVERRIDE {}
18
19  virtual void SetURL(const char* url, int port) OVERRIDE {}
20
21  virtual void SetPostPayload(const char* content_type,
22                              int content_length,
23                              const char* content) OVERRIDE {}
24
25  virtual bool MakeSynchronousPost(int* error_code,
26                                   int* response_code) OVERRIDE;
27
28  virtual int GetResponseContentLength() const OVERRIDE;
29
30  virtual const char* GetResponseContent() const OVERRIDE;
31
32  virtual const std::string GetResponseHeaderValue(
33      const std::string&) const OVERRIDE;
34
35  virtual void Abort() OVERRIDE;
36  // End syncer::HttpPostProviderInterface implementation.
37};
38
39class TestHttpBridgeFactory : public syncer::HttpPostProviderFactory {
40 public:
41  TestHttpBridgeFactory();
42  virtual ~TestHttpBridgeFactory();
43
44  // syncer::HttpPostProviderFactory:
45  virtual syncer::HttpPostProviderInterface* Create() OVERRIDE;
46  virtual void Destroy(syncer::HttpPostProviderInterface* http) OVERRIDE;
47  virtual void Shutdown() OVERRIDE;
48};
49
50}  // namespace browser_sync
51
52#endif  // CHROME_BROWSER_SYNC_TEST_TEST_HTTP_BRIDGE_FACTORY_H_
53