More minor OgHttp2Adapter changes for Chromium.
Chromium does not seem to have an operator<<(ostream) overload for complex
containers, change LogFriendly().
Add one include.
Change one stray signed-unsigned comparison.
PiperOrigin-RevId: 388922741
diff --git a/http2/adapter/oghttp2_adapter_test.cc b/http2/adapter/oghttp2_adapter_test.cc
index 3069c45..7c038ce 100644
--- a/http2/adapter/oghttp2_adapter_test.cc
+++ b/http2/adapter/oghttp2_adapter_test.cc
@@ -435,7 +435,7 @@
EXPECT_CALL(visitor, OnBeginDataForStream(1, _));
EXPECT_CALL(visitor, OnDataForStream(1, "This is the response body."));
- const ssize_t stream_result = adapter->ProcessBytes(stream_frames);
+ const size_t stream_result = adapter->ProcessBytes(stream_frames);
EXPECT_EQ(stream_result, stream_frames.size());
EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, 0, 0x1));
diff --git a/http2/adapter/test_utils.cc b/http2/adapter/test_utils.cc
index 04b126f..b8acddb 100644
--- a/http2/adapter/test_utils.cc
+++ b/http2/adapter/test_utils.cc
@@ -1,5 +1,8 @@
#include "http2/adapter/test_utils.h"
+#include <ostream>
+
+#include "absl/strings/str_format.h"
#include "common/quiche_endian.h"
#include "spdy/core/hpack/hpack_encoder.h"
#include "spdy/core/spdy_frame_reader.h"
@@ -97,17 +100,16 @@
using TypeAndOptionalLength =
std::pair<spdy::SpdyFrameType, absl::optional<size_t>>;
-std::vector<std::pair<const char*, std::string>> LogFriendly(
+std::ostream& operator<<(
+ std::ostream& os,
const std::vector<TypeAndOptionalLength>& types_and_lengths) {
- std::vector<std::pair<const char*, std::string>> out;
- out.reserve(types_and_lengths.size());
for (const auto& type_and_length : types_and_lengths) {
- out.push_back({spdy::FrameTypeToString(type_and_length.first),
- type_and_length.second
- ? absl::StrCat(type_and_length.second.value())
- : "<unspecified>"});
+ os << "(" << spdy::FrameTypeToString(type_and_length.first) << ", "
+ << (type_and_length.second ? absl::StrCat(type_and_length.second.value())
+ : "<unspecified>")
+ << ") ";
}
- return out;
+ return os;
}
std::string FrameTypeToString(uint8_t frame_type) {
@@ -181,12 +183,12 @@
void DescribeTo(std::ostream* os) const override {
*os << "Data contains frames of types in sequence "
- << LogFriendly(expected_types_and_lengths_);
+ << expected_types_and_lengths_;
}
void DescribeNegationTo(std::ostream* os) const override {
*os << "Data does not contain frames of types in sequence "
- << LogFriendly(expected_types_and_lengths_);
+ << expected_types_and_lengths_;
}
private: