Coverage Report

Created: 2023-11-12 09:30

/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
3.87k
MockRequestEncoder::MockRequestEncoder() {
15
3.87k
  ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_));
16
3.87k
  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
3.87k
}
Envoy::Http::MockRequestEncoder::MockRequestEncoder()
Line
Count
Source
14
3.87k
MockRequestEncoder::MockRequestEncoder() {
15
3.87k
  ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_));
16
3.87k
  ON_CALL(*this, encodeHeaders(_, _))
17
3.87k
      .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
3.87k
        ASSERT(HeaderUtility::checkRequiredRequestHeaders(headers).ok());
21
3.87k
        return okStatus();
22
3.87k
      }));
23
3.87k
}
Unexecuted instantiation: Envoy::Http::MockRequestEncoder::MockRequestEncoder()
24
3.87k
MockRequestEncoder::~MockRequestEncoder() = default;
25
26
170k
MockResponseEncoder::MockResponseEncoder() {
27
170k
  ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_));
28
170k
  ON_CALL(*this, encodeHeaders(_, _))
29
170k
      .WillByDefault(Invoke([](const ResponseHeaderMap& headers, bool) {
30
        // Check for passing request headers as response headers in a test.
31
7.77k
        ASSERT_NE(nullptr, headers.Status());
32
7.77k
      }));
33
170k
}
Envoy::Http::MockResponseEncoder::MockResponseEncoder()
Line
Count
Source
26
170k
MockResponseEncoder::MockResponseEncoder() {
27
170k
  ON_CALL(*this, getStream()).WillByDefault(ReturnRef(stream_));
28
170k
  ON_CALL(*this, encodeHeaders(_, _))
29
170k
      .WillByDefault(Invoke([](const ResponseHeaderMap& headers, bool) {
30
        // Check for passing request headers as response headers in a test.
31
170k
        ASSERT_NE(nullptr, headers.Status());
32
170k
      }));
33
170k
}
Unexecuted instantiation: Envoy::Http::MockResponseEncoder::MockResponseEncoder()
34
35
170k
MockResponseEncoder::~MockResponseEncoder() {
36
  // We notify the adapter here to avoid NiceMock dtor from
37
  // no longer suppressing uninteresting calls.
38
170k
  if (stream_.codec_callbacks_) {
39
0
    stream_.codec_callbacks_->onCodecLowLevelReset();
40
0
  }
41
170k
}
42
43
} // namespace Http
44
} // namespace Envoy