gfe-relnote: (n/a) Platformize logging for http2. Refactor only, no behavior change.
Note on merge: http2/platform/impl/http2_logging_impl.h also needs to be merged to Chromium.
PiperOrigin-RevId: 237381363
Change-Id: I98a69eaeca7ac1353054120681e18e99a73c63c4
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
index 009b894..11b0d97 100644
--- a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
@@ -8,9 +8,9 @@
#include <initializer_list>
-#include "base/logging.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h"
@@ -31,10 +31,10 @@
State state() const { return buf_.state_for_testing(); }
Backing backing() const { return buf_.backing_for_testing(); }
- // We want to know that LOG(x) << buf_ will work in production should that
- // be needed, so we test that it outputs the expected values.
+ // We want to know that HTTP2_LOG(x) << buf_ will work in production should
+ // that be needed, so we test that it outputs the expected values.
AssertionResult VerifyLogHasSubstrs(std::initializer_list<Http2String> strs) {
- VLOG(1) << buf_;
+ HTTP2_VLOG(1) << buf_;
std::ostringstream ss;
buf_.OutputDebugStringTo(ss);
Http2String dbg_str(ss.str());
@@ -54,7 +54,7 @@
EXPECT_TRUE(VerifyLogHasSubstrs({"state=RESET"}));
buf_.Set(data, /*is_static*/ true);
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_EQ(state(), State::COMPLETE);
EXPECT_EQ(backing(), Backing::STATIC);
EXPECT_EQ(data, buf_.str());
@@ -75,13 +75,13 @@
TEST_F(HpackDecoderStringBufferTest, PlainWhole) {
Http2StringPiece data("some text.");
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_EQ(state(), State::RESET);
buf_.OnStart(/*huffman_encoded*/ false, data.size());
EXPECT_EQ(state(), State::COLLECTING);
EXPECT_EQ(backing(), Backing::RESET);
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_TRUE(buf_.OnData(data.data(), data.size()));
EXPECT_EQ(state(), State::COLLECTING);
@@ -101,7 +101,7 @@
// Now force it to buffer the string, after which it will still have the same
// string value, but the backing store will be different.
buf_.BufferStringIfUnbuffered();
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_EQ(buf_.BufferedLength(), data.size());
EXPECT_EQ(data, buf_.str());
@@ -126,7 +126,7 @@
EXPECT_EQ(state(), State::COLLECTING);
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_EQ(buf_.BufferedLength(), part1.size());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_TRUE(buf_.OnData(part2.data(), part2.size()));
EXPECT_EQ(state(), State::COLLECTING);
@@ -137,7 +137,7 @@
EXPECT_EQ(state(), State::COMPLETE);
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_EQ(buf_.BufferedLength(), data.size());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
Http2StringPiece buffered = buf_.str();
EXPECT_EQ(data, buffered);
@@ -188,31 +188,31 @@
EXPECT_EQ(state(), State::COLLECTING);
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_EQ(0u, buf_.BufferedLength());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_TRUE(buf_.OnData(part1.data(), part1.size()));
EXPECT_EQ(state(), State::COLLECTING);
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_GT(buf_.BufferedLength(), 0u);
EXPECT_LT(buf_.BufferedLength(), decoded.size());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_TRUE(buf_.OnData(part2.data(), part2.size()));
EXPECT_EQ(state(), State::COLLECTING);
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_EQ(buf_.BufferedLength(), decoded.size());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
EXPECT_TRUE(buf_.OnEnd());
EXPECT_EQ(state(), State::COMPLETE);
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_EQ(buf_.BufferedLength(), decoded.size());
EXPECT_EQ(decoded, buf_.str());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
buf_.Reset();
EXPECT_EQ(state(), State::RESET);
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
}
TEST_F(HpackDecoderStringBufferTest, InvalidHuffmanOnData) {
@@ -226,7 +226,7 @@
EXPECT_EQ(state(), State::COLLECTING);
EXPECT_EQ(backing(), Backing::BUFFERED);
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
}
TEST_F(HpackDecoderStringBufferTest, InvalidHuffmanOnEnd) {
@@ -241,7 +241,7 @@
EXPECT_EQ(backing(), Backing::BUFFERED);
EXPECT_FALSE(buf_.OnEnd());
- LOG(INFO) << buf_;
+ HTTP2_LOG(INFO) << buf_;
}
// TODO(jamessynge): Add tests for ReleaseString().