Replace QUICHE_ARRAYSIZE with ABSL_ARRAYSIZE. PiperOrigin-RevId: 337929910 Change-Id: I50017ef611cb3bfd1b2219b2b58d86bab2a51c9e
diff --git a/quic/core/http/http_decoder_test.cc b/quic/core/http/http_decoder_test.cc index 9b6c4e2..9558b9a 100644 --- a/quic/core/http/http_decoder_test.cc +++ b/quic/core/http/http_decoder_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/http/http_encoder.h" #include "net/third_party/quiche/src/quic/core/http/http_frames.h" @@ -14,7 +15,6 @@ #include "net/third_party/quiche/src/quic/core/quic_versions.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" #include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h" @@ -775,7 +775,7 @@ writer.WriteStringPiece("Malformed payload"); EXPECT_CALL(visitor_, OnError(&decoder_)); - EXPECT_EQ(5u, decoder_.ProcessInput(input, QUICHE_ARRAYSIZE(input))); + EXPECT_EQ(5u, decoder_.ProcessInput(input, ABSL_ARRAYSIZE(input))); EXPECT_THAT(decoder_.error(), IsError(QUIC_HTTP_FRAME_TOO_LARGE)); EXPECT_EQ("Frame is too large.", decoder_.error_detail()); }
diff --git a/quic/core/http/http_encoder_test.cc b/quic/core/http/http_encoder_test.cc index f6c0444..50afdd3 100644 --- a/quic/core/http/http_encoder_test.cc +++ b/quic/core/http/http_encoder_test.cc
@@ -4,9 +4,9 @@ #include "net/third_party/quiche/src/quic/core/http/http_encoder.h" +#include "absl/base/macros.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h" namespace quic { @@ -20,9 +20,9 @@ 0x00, // length 0x05}; - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError("DATA", buffer.get(), length, - output, QUICHE_ARRAYSIZE(output)); + output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializeHeadersFrameHeader) { @@ -33,9 +33,9 @@ 0x01, // length 0x07}; - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError("HEADERS", buffer.get(), length, - output, QUICHE_ARRAYSIZE(output)); + output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializeCancelPushFrame) { @@ -49,9 +49,9 @@ 0x01}; std::unique_ptr<char[]> buffer; uint64_t length = HttpEncoder::SerializeCancelPushFrame(cancel_push, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError( - "CANCEL_PUSH", buffer.get(), length, output, QUICHE_ARRAYSIZE(output)); + "CANCEL_PUSH", buffer.get(), length, output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializeSettingsFrame) { @@ -77,9 +77,9 @@ 0x04}; std::unique_ptr<char[]> buffer; uint64_t length = HttpEncoder::SerializeSettingsFrame(settings, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError("SETTINGS", buffer.get(), length, - output, QUICHE_ARRAYSIZE(output)); + output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializePushPromiseFrameWithOnlyPushId) { @@ -95,9 +95,9 @@ std::unique_ptr<char[]> buffer; uint64_t length = HttpEncoder::SerializePushPromiseFrameWithOnlyPushId( push_promise, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError( - "PUSH_PROMISE", buffer.get(), length, output, QUICHE_ARRAYSIZE(output)); + "PUSH_PROMISE", buffer.get(), length, output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializeGoAwayFrame) { @@ -111,9 +111,9 @@ 0x01}; std::unique_ptr<char[]> buffer; uint64_t length = HttpEncoder::SerializeGoAwayFrame(goaway, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError("GOAWAY", buffer.get(), length, - output, QUICHE_ARRAYSIZE(output)); + output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializeMaxPushIdFrame) { @@ -127,9 +127,9 @@ 0x01}; std::unique_ptr<char[]> buffer; uint64_t length = HttpEncoder::SerializeMaxPushIdFrame(max_push_id, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output), length); quiche::test::CompareCharArraysWithHexError( - "MAX_PUSH_ID", buffer.get(), length, output, QUICHE_ARRAYSIZE(output)); + "MAX_PUSH_ID", buffer.get(), length, output, ABSL_ARRAYSIZE(output)); } TEST(HttpEncoderTest, SerializePriorityUpdateFrame) { @@ -144,10 +144,10 @@ std::unique_ptr<char[]> buffer; uint64_t length = HttpEncoder::SerializePriorityUpdateFrame(priority_update1, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output1), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output1), length); quiche::test::CompareCharArraysWithHexError("PRIORITY_UPDATE", buffer.get(), length, output1, - QUICHE_ARRAYSIZE(output1)); + ABSL_ARRAYSIZE(output1)); PriorityUpdateFrame priority_update2; priority_update2.prioritized_element_type = PUSH_STREAM; @@ -159,10 +159,10 @@ 0x05, // prioritized element id 'f', 'o', 'o'}; // priority field value length = HttpEncoder::SerializePriorityUpdateFrame(priority_update2, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output2), length); + EXPECT_EQ(ABSL_ARRAYSIZE(output2), length); quiche::test::CompareCharArraysWithHexError("PRIORITY_UPDATE", buffer.get(), length, output2, - QUICHE_ARRAYSIZE(output2)); + ABSL_ARRAYSIZE(output2)); } } // namespace test
diff --git a/quic/core/http/quic_headers_stream.cc b/quic/core/http/quic_headers_stream.cc index 8157dae..1cce85f 100644 --- a/quic/core/http/quic_headers_stream.cc +++ b/quic/core/http/quic_headers_stream.cc
@@ -4,11 +4,11 @@ #include "net/third_party/quiche/src/quic/core/http/quic_headers_stream.h" +#include "absl/base/macros.h" #include "net/third_party/quiche/src/quic/core/http/quic_spdy_session.h" #include "net/third_party/quiche/src/quic/core/quic_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" namespace quic {
diff --git a/quic/core/http/quic_send_control_stream.cc b/quic/core/http/quic_send_control_stream.cc index 9540763..939c327 100644 --- a/quic/core/http/quic_send_control_stream.cc +++ b/quic/core/http/quic_send_control_stream.cc
@@ -6,6 +6,7 @@ #include <cstdint> #include <memory> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" #include "net/third_party/quiche/src/quic/core/http/http_constants.h" @@ -14,7 +15,6 @@ #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/core/quic_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" namespace quic { @@ -45,7 +45,7 @@ QuicConnection::ScopedPacketFlusher flusher(session()->connection()); // Send the stream type on so the peer knows about this stream. char data[sizeof(kControlStream)]; - QuicDataWriter writer(QUICHE_ARRAYSIZE(data), data); + QuicDataWriter writer(ABSL_ARRAYSIZE(data), data); writer.WriteVarInt62(kControlStream); WriteOrBufferData(absl::string_view(writer.data(), writer.length()), false, nullptr);
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc index 39ee3d0..18e8712 100644 --- a/quic/core/http/quic_spdy_client_session_test.cc +++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/crypto/null_decrypter.h" #include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h" @@ -37,7 +38,6 @@ #include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" #include "net/third_party/quiche/src/quic/test_tools/simple_session_cache.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" using spdy::SpdyHeaderBlock; @@ -280,7 +280,7 @@ // Verify that no data may be send on existing streams. char data[] = "hello world"; EXPECT_QUIC_BUG( - session_->WritevData(stream->id(), QUICHE_ARRAYSIZE(data), 0, NO_FIN, + session_->WritevData(stream->id(), ABSL_ARRAYSIZE(data), 0, NO_FIN, NOT_RETRANSMISSION, absl::nullopt), "Client: Try to send data of stream"); }
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc index 4756db4..07c6f4e 100644 --- a/quic/core/http/quic_spdy_session_test.cc +++ b/quic/core/http/quic_spdy_session_test.cc
@@ -10,6 +10,7 @@ #include <string> #include <utility> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h" #include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h" @@ -42,7 +43,6 @@ #include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_stream_send_buffer_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" #include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h" #include "net/third_party/quiche/src/common/quiche_endian.h" @@ -2271,7 +2271,7 @@ char input[] = {0x04, // type 'a', 'b', 'c'}; // data - absl::string_view payload(input, QUICHE_ARRAYSIZE(input)); + absl::string_view payload(input, ABSL_ARRAYSIZE(input)); // This is a server test with a client-initiated unidirectional stream. QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId( @@ -2323,7 +2323,7 @@ char input[] = {0x04, // type 'a', 'b', 'c'}; // data - absl::string_view payload(input, QUICHE_ARRAYSIZE(input)); + absl::string_view payload(input, ABSL_ARRAYSIZE(input)); // This is a server test with a client-initiated unidirectional stream. QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId( @@ -2364,7 +2364,7 @@ char input[] = {0x41, 0x00, // type (256) 'a', 'b', 'c'}; // data - absl::string_view payload(input, QUICHE_ARRAYSIZE(input)); + absl::string_view payload(input, ABSL_ARRAYSIZE(input)); // This is a server test with a client-initiated unidirectional stream. QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId( @@ -2943,7 +2943,7 @@ {kQpackEncoderStream, "RESET_STREAM received for QPACK receive stream"}, {kQpackDecoderStream, "RESET_STREAM received for QPACK receive stream"}, }; - for (size_t i = 0; i < QUICHE_ARRAYSIZE(kTestData); ++i) { + for (size_t i = 0; i < ABSL_ARRAYSIZE(kTestData); ++i) { QuicStreamId stream_id = GetNthClientInitiatedUnidirectionalStreamId(transport_version(), i + 1); const QuicByteCount data_length = 1;
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc index 1a217f5..f069bad 100644 --- a/quic/core/http/quic_spdy_stream.cc +++ b/quic/core/http/quic_spdy_stream.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/http/http_constants.h" #include "net/third_party/quiche/src/quic/core/http/http_decoder.h" @@ -23,7 +24,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" #include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_storage.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h" #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" @@ -263,7 +263,7 @@ if (VersionUsesHttp3(transport_version()) && type() == WRITE_UNIDIRECTIONAL && send_buffer().stream_offset() == 0) { char data[sizeof(kServerPushStream)]; - QuicDataWriter writer(QUICHE_ARRAYSIZE(data), data); + QuicDataWriter writer(ABSL_ARRAYSIZE(data), data); writer.WriteVarInt62(kServerPushStream); // Similar to frame headers, stream type byte shouldn't be exposed to upper
diff --git a/quic/core/http/quic_spdy_stream_body_manager_test.cc b/quic/core/http/quic_spdy_stream_body_manager_test.cc index 85d3a2f..aaa8cce 100644 --- a/quic/core/http/quic_spdy_stream_body_manager_test.cc +++ b/quic/core/http/quic_spdy_stream_body_manager_test.cc
@@ -8,11 +8,11 @@ #include <numeric> #include <string> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" namespace quic { @@ -75,7 +75,7 @@ }; for (size_t test_case_index = 0; - test_case_index < QUICHE_ARRAYSIZE(kOnBodyConsumedTestData); + test_case_index < ABSL_ARRAYSIZE(kOnBodyConsumedTestData); ++test_case_index) { const std::vector<QuicByteCount>& frame_header_lengths = kOnBodyConsumedTestData[test_case_index].frame_header_lengths; @@ -127,8 +127,7 @@ }; for (size_t test_case_index = 0; - test_case_index < QUICHE_ARRAYSIZE(kPeekBodyTestData); - ++test_case_index) { + test_case_index < ABSL_ARRAYSIZE(kPeekBodyTestData); ++test_case_index) { const std::vector<QuicByteCount>& frame_header_lengths = kPeekBodyTestData[test_case_index].frame_header_lengths; const std::vector<const char*>& frame_payloads = @@ -221,8 +220,7 @@ }; for (size_t test_case_index = 0; - test_case_index < QUICHE_ARRAYSIZE(kReadBodyTestData); - ++test_case_index) { + test_case_index < ABSL_ARRAYSIZE(kReadBodyTestData); ++test_case_index) { const std::vector<QuicByteCount>& frame_header_lengths = kReadBodyTestData[test_case_index].frame_header_lengths; const std::vector<const char*>& frame_payloads =
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc index 03afd72..6cd7634 100644 --- a/quic/core/http/quic_spdy_stream_test.cc +++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -9,6 +9,7 @@ #include <string> #include <utility> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h" #include "net/third_party/quiche/src/quic/core/http/http_encoder.h" @@ -31,7 +32,6 @@ #include "net/third_party/quiche/src/quic/test_tools/quic_spdy_stream_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h" using spdy::kV3HighestPriority; @@ -190,7 +190,7 @@ char buffer[2048]; struct iovec vec; vec.iov_base = buffer; - vec.iov_len = QUICHE_ARRAYSIZE(buffer); + vec.iov_len = ABSL_ARRAYSIZE(buffer); size_t bytes_read = Readv(&vec, 1); data_ += std::string(buffer, bytes_read); } @@ -797,10 +797,10 @@ stream_->ConsumeHeaderList(); char buffer[2048]; - ASSERT_LT(data.length(), QUICHE_ARRAYSIZE(buffer)); + ASSERT_LT(data.length(), ABSL_ARRAYSIZE(buffer)); struct iovec vec; vec.iov_base = buffer; - vec.iov_len = QUICHE_ARRAYSIZE(buffer); + vec.iov_len = ABSL_ARRAYSIZE(buffer); size_t bytes_read = stream_->Readv(&vec, 1); QuicStreamPeer::CloseReadSide(stream_); @@ -822,9 +822,9 @@ char buffer2[2048]; struct iovec vec[2]; vec[0].iov_base = buffer; - vec[0].iov_len = QUICHE_ARRAYSIZE(buffer); + vec[0].iov_len = ABSL_ARRAYSIZE(buffer); vec[1].iov_base = buffer2; - vec[1].iov_len = QUICHE_ARRAYSIZE(buffer2); + vec[1].iov_len = ABSL_ARRAYSIZE(buffer2); size_t bytes_read = stream_->Readv(vec, 2); EXPECT_EQ(2048u * 2, bytes_read); EXPECT_EQ(body.substr(0, 2048), std::string(buffer, 2048)); @@ -889,7 +889,7 @@ char buffer[1]; struct iovec vec; vec.iov_base = buffer; - vec.iov_len = QUICHE_ARRAYSIZE(buffer); + vec.iov_len = ABSL_ARRAYSIZE(buffer); for (size_t i = 0; i < body.length(); ++i) { size_t bytes_read = stream_->Readv(&vec, 1); @@ -914,9 +914,9 @@ char buffer2[1]; struct iovec vec[2]; vec[0].iov_base = buffer1; - vec[0].iov_len = QUICHE_ARRAYSIZE(buffer1); + vec[0].iov_len = ABSL_ARRAYSIZE(buffer1); vec[1].iov_base = buffer2; - vec[1].iov_len = QUICHE_ARRAYSIZE(buffer2); + vec[1].iov_len = ABSL_ARRAYSIZE(buffer2); for (size_t i = 0; i < body.length(); i += 2) { size_t bytes_read = stream_->Readv(vec, 2); @@ -2067,7 +2067,7 @@ char buffer[2048]; struct iovec vec; vec.iov_base = buffer; - vec.iov_len = QUICHE_ARRAYSIZE(buffer); + vec.iov_len = ABSL_ARRAYSIZE(buffer); size_t bytes_read = stream_->Readv(&vec, 1); EXPECT_EQ(kDataFramePayload, absl::string_view(buffer, bytes_read));
diff --git a/quic/core/http/spdy_server_push_utils_test.cc b/quic/core/http/spdy_server_push_utils_test.cc index ed7895e..fa98f07 100644 --- a/quic/core/http/spdy_server_push_utils_test.cc +++ b/quic/core/http/spdy_server_push_utils_test.cc
@@ -7,8 +7,8 @@ #include <memory> #include <string> +#include "absl/base/macros.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" using spdy::SpdyHeaderBlock; @@ -157,11 +157,11 @@ {"[::ffff:192.168", 0}, {"]/", 0}, {"//", 0}}; - for (size_t i = 0; i < QUICHE_ARRAYSIZE(input_headers); ++i) { + for (size_t i = 0; i < ABSL_ARRAYSIZE(input_headers); ++i) { bool should_accept = (input_headers[i].second & SCHEME); - for (size_t j = 0; j < QUICHE_ARRAYSIZE(input_headers); ++j) { + for (size_t j = 0; j < ABSL_ARRAYSIZE(input_headers); ++j) { bool should_accept_2 = should_accept && (input_headers[j].second & AUTH); - for (size_t k = 0; k < QUICHE_ARRAYSIZE(input_headers); ++k) { + for (size_t k = 0; k < ABSL_ARRAYSIZE(input_headers); ++k) { // |should_accept_3| indicates whether or not GetPushPromiseUrl() is // expected to accept this input combination. bool should_accept_3 =
diff --git a/quic/core/http/spdy_utils_test.cc b/quic/core/http/spdy_utils_test.cc index 5932d8e..9216a53 100644 --- a/quic/core/http/spdy_utils_test.cc +++ b/quic/core/http/spdy_utils_test.cc
@@ -5,10 +5,10 @@ #include <memory> #include <string> +#include "absl/base/macros.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/http/spdy_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h" using spdy::SpdyHeaderBlock;