proxygen
Mocks.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 
15 
16 namespace proxygen {
17 
23  public:
25 #ifdef __clang__
26 # pragma clang diagnostic push
27 # if __clang_major__ > 3 || __clang_minor__ >= 6
28 # pragma clang diagnostic ignored "-Winconsistent-missing-override"
29 # endif
30 #endif
32  GMOCK_METHOD1_(, noexcept, , sendChunkHeader, void(size_t));
33  GMOCK_METHOD1_(, noexcept, , sendBody, void(std::shared_ptr<folly::IOBuf>));
35  GMOCK_METHOD0_(, noexcept, , sendEOM, void());
36  GMOCK_METHOD0_(, noexcept, , sendAbort, void());
38  GMOCK_METHOD0_(, noexcept, , pauseIngress, void());
42 
44 #ifdef __clang__
45 # pragma clang diagnostic pop
46 #endif
47 
49  return transportInfo;
50  }
51 
52  void sendBody(std::unique_ptr<folly::IOBuf> body) noexcept override {
53  if (body) {
54  sendBody(std::shared_ptr<folly::IOBuf>(body.release()));
55  } else {
56  sendBody(std::shared_ptr<folly::IOBuf>(nullptr));
57  }
58  }
59 
61 };
62 
64  public:
65 #ifdef __clang__
66 # pragma clang diagnostic push
67 # if __clang_major__ > 3 || __clang_minor__ >= 6
68 # pragma clang diagnostic ignored "-Winconsistent-missing-override"
69 # endif
70 #endif
71  GMOCK_METHOD1_(, noexcept, , setResponseHandler, void(ResponseHandler*));
72  GMOCK_METHOD1_(, noexcept, , onRequest, void(std::shared_ptr<HTTPMessage>));
73  GMOCK_METHOD1_(, noexcept, , onBody, void(std::shared_ptr<folly::IOBuf>));
74  GMOCK_METHOD1_(, noexcept, , onUpgrade, void(UpgradeProtocol));
75  GMOCK_METHOD0_(, noexcept, , onEOM, void());
76  GMOCK_METHOD0_(, noexcept, , requestComplete, void());
77  GMOCK_METHOD1_(, noexcept, , onError, void(ProxygenError));
78  GMOCK_METHOD0_(, noexcept, , onEgressPaused, void());
79  GMOCK_METHOD0_(, noexcept, , onEgressResumed, void());
80  GMOCK_METHOD0_(, noexcept, , canHandleExpect, bool());
81 #ifdef __clang__
82 # pragma clang diagnostic pop
83 #endif
84 
85  void onRequest(std::unique_ptr<HTTPMessage> headers) noexcept override {
86  onRequest(std::shared_ptr<HTTPMessage>(headers.release()));
87  }
88 
89  void onBody(std::unique_ptr<folly::IOBuf> body) noexcept override {
90  if (body) {
91  onBody(std::shared_ptr<folly::IOBuf>(body.release()));
92  } else {
93  onBody(std::shared_ptr<folly::IOBuf>(nullptr));
94  }
95  }
96 };
97 
98 }
GMOCK_METHOD1_(, noexcept,, sendHeaders, void(HTTPMessage &))
virtual void sendChunkTerminator() noexcept=0
*than *hazptr_holder h
Definition: Hazptr.h:116
virtual void sendEOM() noexcept=0
virtual void getCurrentTransportInfo(wangle::TransportInfo *tinfo) const =0
MockResponseHandler(RequestHandler *h)
Definition: Mocks.h:24
virtual void sendChunkHeader(size_t len) noexcept=0
void sendBody(std::unique_ptr< folly::IOBuf > body) noexceptoverride
Definition: Mocks.h:52
requires E e noexcept(noexcept(s.error(std::move(e))))
GMOCK_METHOD0_(, noexcept,, sendChunkTerminator, void())
virtual void sendAbort() noexcept=0
virtual void resumeIngress() noexcept=0
virtual void sendHeaders(HTTPMessage &msg) noexcept=0
MOCK_CONST_METHOD1(getCurrentTransportInfo, void(wangle::TransportInfo *))
const wangle::TransportInfo & getSetupTransportInfo() const noexceptoverride
Definition: Mocks.h:48
const
Definition: upload.py:398
virtual void refreshTimeout() noexcept=0
void onBody(std::unique_ptr< folly::IOBuf > body) noexceptoverride
Definition: Mocks.h:89
void onRequest(std::unique_ptr< HTTPMessage > headers) noexceptoverride
Definition: Mocks.h:85
virtual void pauseIngress() noexcept=0
wangle::TransportInfo transportInfo
Definition: Mocks.h:60
virtual ResponseHandler * newPushedResponse(PushHandler *pushHandler) noexcept=0