proxygen
MockHTTPMessageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
13 
14 namespace proxygen {
15 
16 static const std::string kMockFilterName = "MockFilter";
17 
19  public:
21  void(std::shared_ptr<HTTPMessage>));
22  void onHeadersComplete(std::unique_ptr<HTTPMessage> msg) noexcept override {
23  onHeadersComplete(std::shared_ptr<HTTPMessage>(msg.release()));
24  }
25 
26  GMOCK_METHOD1_(, noexcept,, onBody, void(std::shared_ptr<folly::IOBuf>));
27  void onBody(std::unique_ptr<folly::IOBuf> chain) noexcept override {
28  onBody(std::shared_ptr<folly::IOBuf>(chain.release()));
29  }
30  GMOCK_METHOD1_(, noexcept,, onChunkHeader, void(size_t));
33  void(std::shared_ptr<HTTPHeaders> trailers));
34  void onTrailers(std::unique_ptr<HTTPHeaders> trailers) noexcept override {
35  onTrailers(std::shared_ptr<HTTPHeaders>(trailers.release()));
36  }
37  GMOCK_METHOD0_(, noexcept,, onEOM, void());
39  GMOCK_METHOD1_(, noexcept,, onError, void(const HTTPException&));
40 
41  void nextOnHeadersCompletePublic(std::shared_ptr<HTTPMessage> msg) {
42  std::unique_ptr<HTTPMessage> msgU(new HTTPMessage(*msg));
44  }
45 
46  const std::string& getFilterName() noexcept override {
47  return kMockFilterName;
48  }
49 
50  [[noreturn]] std::unique_ptr<HTTPMessageFilter> clone() noexcept override {
51  LOG(FATAL) << "clone() not implemented for filter: "
52  << this->getFilterName();
53  };
54 
55  void nextOnEOMPublic() {
56  nextOnEOM();
57  }
58 };
59 
60 }
void onEOM() noexceptoverride
GMOCK_METHOD0_(, noexcept,, onChunkComplete, void())
void onError(const HTTPException &error) noexceptoverride
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void onTrailers(std::unique_ptr< HTTPHeaders > trailers) noexceptoverride
void nextOnHeadersCompletePublic(std::shared_ptr< HTTPMessage > msg)
std::unique_ptr< HTTPMessageFilter > clone() noexceptoverride
requires E e noexcept(noexcept(s.error(std::move(e))))
void onUpgrade(UpgradeProtocol protocol) noexceptoverride
static const std::string kMockFilterName
void onBody(std::unique_ptr< folly::IOBuf > chain) noexceptoverride
void onChunkHeader(size_t length) noexceptoverride
void nextOnHeadersComplete(std::unique_ptr< HTTPMessage > msg)
GMOCK_METHOD1_(, noexcept,, onHeadersComplete, void(std::shared_ptr< HTTPMessage >))
const char * string
Definition: Conv.cpp:212
void onChunkComplete() noexceptoverride
const std::string & getFilterName() noexceptoverride
void onHeadersComplete(std::unique_ptr< HTTPMessage > msg) noexceptoverride