/proc/self/cwd/test/mocks/http/stream_encoder.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "test/mocks/http/stream_encoder.h" |
2 | | |
3 | | #include "source/common/http/header_utility.h" |
4 | | |
5 | | using testing::_; |
6 | | using testing::Invoke; |
7 | | |
8 | | namespace Envoy { |
9 | | namespace Http { |
10 | | |
11 | 0 | MockHttp1StreamEncoderOptions::MockHttp1StreamEncoderOptions() = default; |
12 | 0 | MockHttp1StreamEncoderOptions::~MockHttp1StreamEncoderOptions() = default; |
13 | | |
14 | 2.63k | MockRequestEncoder::MockRequestEncoder() { |
15 | 2.63k | ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_)); |
16 | 2.63k | ON_CALL(*this, encodeHeaders(_, _)) |
17 | 22.3k | .WillByDefault(Invoke([](const RequestHeaderMap& headers, bool) -> Status { |
18 | | // Check to see that method is not-null. Path can be null for CONNECT and authority can be |
19 | | // null at the codec level. |
20 | 22.3k | ASSERT(HeaderUtility::checkRequiredRequestHeaders(headers).ok()); |
21 | 22.3k | return okStatus(); |
22 | 22.3k | })); |
23 | 2.63k | } Envoy::Http::MockRequestEncoder::MockRequestEncoder() Line | Count | Source | 14 | 2.63k | MockRequestEncoder::MockRequestEncoder() { | 15 | 2.63k | ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_)); | 16 | 2.63k | ON_CALL(*this, encodeHeaders(_, _)) | 17 | 2.63k | .WillByDefault(Invoke([](const RequestHeaderMap& headers, bool) -> Status { | 18 | | // Check to see that method is not-null. Path can be null for CONNECT and authority can be | 19 | | // null at the codec level. | 20 | 2.63k | ASSERT(HeaderUtility::checkRequiredRequestHeaders(headers).ok()); | 21 | 2.63k | return okStatus(); | 22 | 2.63k | })); | 23 | 2.63k | } |
Unexecuted instantiation: Envoy::Http::MockRequestEncoder::MockRequestEncoder() |
24 | 2.63k | MockRequestEncoder::~MockRequestEncoder() = default; |
25 | | |
26 | 189k | MockResponseEncoder::MockResponseEncoder() { |
27 | 189k | ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_)); |
28 | 189k | ON_CALL(*this, encodeHeaders(_, _)) |
29 | 189k | .WillByDefault(Invoke([](const ResponseHeaderMap& headers, bool) { |
30 | | // Check for passing request headers as response headers in a test. |
31 | 7.22k | ASSERT_NE(nullptr, headers.Status()); |
32 | 7.22k | })); |
33 | 189k | } Envoy::Http::MockResponseEncoder::MockResponseEncoder() Line | Count | Source | 26 | 189k | MockResponseEncoder::MockResponseEncoder() { | 27 | 189k | ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_)); | 28 | 189k | ON_CALL(*this, encodeHeaders(_, _)) | 29 | 189k | .WillByDefault(Invoke([](const ResponseHeaderMap& headers, bool) { | 30 | | // Check for passing request headers as response headers in a test. | 31 | 189k | ASSERT_NE(nullptr, headers.Status()); | 32 | 189k | })); | 33 | 189k | } |
Unexecuted instantiation: Envoy::Http::MockResponseEncoder::MockResponseEncoder() |
34 | | |
35 | 189k | MockResponseEncoder::~MockResponseEncoder() { |
36 | | // We notify the adapter here to avoid NiceMock dtor from |
37 | | // no longer suppressing uninteresting calls. |
38 | 189k | if (stream_.codec_callbacks_) { |
39 | 0 | stream_.codec_callbacks_->onCodecLowLevelReset(); |
40 | 0 | } |
41 | 189k | } |
42 | | |
43 | | } // namespace Http |
44 | | } // namespace Envoy |