aboutsummaryrefslogtreecommitdiffstats
path: root/brillo/http/mock_connection.h
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2015-10-12 15:21:28 -0700
committerAlex Vakulenko <avakulenko@google.com>2015-10-13 16:10:03 -0700
commit9ed0cab99f18acb3570a35e9408f24355f6b8324 (patch)
tree60e3b4c2822b812b3218489a9a6d835df1e8ca6e /brillo/http/mock_connection.h
parenteabfe23a51c91a103042793ac2d5c28170994e1f (diff)
downloadplatform_external_libbrillo-9ed0cab99f18acb3570a35e9408f24355f6b8324.tar.gz
platform_external_libbrillo-9ed0cab99f18acb3570a35e9408f24355f6b8324.tar.bz2
platform_external_libbrillo-9ed0cab99f18acb3570a35e9408f24355f6b8324.zip
Move chromeos symbols into brillo namespace
And move the include files into "brillo" directory instead of "chromeos" BUG: 24872993 TEST=built aosp and brillo and unit tests pass on dragonoboard Change-Id: Ieb979d1ebd3152921d36cd15acbd6247f02aae69
Diffstat (limited to 'brillo/http/mock_connection.h')
-rw-r--r--brillo/http/mock_connection.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/brillo/http/mock_connection.h b/brillo/http/mock_connection.h
new file mode 100644
index 0000000..c57aac1
--- /dev/null
+++ b/brillo/http/mock_connection.h
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium OS 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 LIBCHROMEOS_BRILLO_HTTP_MOCK_CONNECTION_H_
+#define LIBCHROMEOS_BRILLO_HTTP_MOCK_CONNECTION_H_
+
+#include <memory>
+#include <string>
+
+#include <base/macros.h>
+#include <brillo/http/http_connection.h>
+#include <gmock/gmock.h>
+
+namespace brillo {
+namespace http {
+
+class MockConnection : public Connection {
+ public:
+ using Connection::Connection;
+
+ MOCK_METHOD2(SendHeaders, bool(const HeaderList&, ErrorPtr*));
+ MOCK_METHOD2(MockSetRequestData, bool(Stream*, ErrorPtr*));
+ MOCK_METHOD1(MockSetResponseData, void(Stream*));
+ MOCK_METHOD1(FinishRequest, bool(ErrorPtr*));
+ MOCK_METHOD2(FinishRequestAsync,
+ RequestID(const SuccessCallback&, const ErrorCallback&));
+ MOCK_CONST_METHOD0(GetResponseStatusCode, int());
+ MOCK_CONST_METHOD0(GetResponseStatusText, std::string());
+ MOCK_CONST_METHOD0(GetProtocolVersion, std::string());
+ MOCK_CONST_METHOD1(GetResponseHeader, std::string(const std::string&));
+ MOCK_CONST_METHOD1(MockExtractDataStream, Stream*(brillo::ErrorPtr*));
+
+ private:
+ bool SetRequestData(StreamPtr stream, brillo::ErrorPtr* error) override {
+ return MockSetRequestData(stream.get(), error);
+ }
+ void SetResponseData(StreamPtr stream) override {
+ MockSetResponseData(stream.get());
+ }
+ StreamPtr ExtractDataStream(brillo::ErrorPtr* error) override {
+ return StreamPtr{MockExtractDataStream(error)};
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(MockConnection);
+};
+
+} // namespace http
+} // namespace brillo
+
+#endif // LIBCHROMEOS_BRILLO_HTTP_MOCK_CONNECTION_H_