Remove HTTP2_ARRAYSIZE; use QUICHE_ARRAYSIZE instead. gfe-relnote: n/a, no functional change. PiperOrigin-RevId: 285454609 Change-Id: Iddb4065449b26ddb6a194ba9409ab4e800cd0f86
diff --git a/http2/hpack/huffman/hpack_huffman_decoder_test.cc b/http2/hpack/huffman/hpack_huffman_decoder_test.cc index e5a6e28..482d39c 100644 --- a/http2/hpack/huffman/hpack_huffman_decoder_test.cc +++ b/http2/hpack/huffman/hpack_huffman_decoder_test.cc
@@ -11,10 +11,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/decode_status.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_arraysize.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" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" using ::testing::AssertionResult; @@ -197,7 +197,7 @@ Http2HexDecode("25a849e95bb8e8b4bf"), "custom-value", }; - for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) { const std::string& huffman_encoded(test_table[i]); const std::string& plain_string(test_table[i + 1]); std::string buffer; @@ -228,7 +228,7 @@ "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", }; // clang-format on - for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) { const std::string& huffman_encoded(test_table[i]); const std::string& plain_string(test_table[i + 1]); std::string buffer;
diff --git a/http2/hpack/huffman/hpack_huffman_encoder_test.cc b/http2/hpack/huffman/hpack_huffman_encoder_test.cc index 24d3cf1..d729d0e 100644 --- a/http2/hpack/huffman/hpack_huffman_encoder_test.cc +++ b/http2/hpack/huffman/hpack_huffman_encoder_test.cc
@@ -5,8 +5,8 @@ #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h" #include "testing/gtest/include/gtest/gtest.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_arraysize.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" namespace http2 { namespace { @@ -22,7 +22,7 @@ Http2HexDecode("25a849e95bb8e8b4bf"), "custom-value", }; - for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) { const std::string& huffman_encoded(test_table[i]); const std::string& plain_string(test_table[i + 1]); EXPECT_EQ(ExactHuffmanSize(plain_string), huffman_encoded.size()); @@ -53,7 +53,7 @@ "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", }; // clang-format on - for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) { const std::string& huffman_encoded(test_table[i]); const std::string& plain_string(test_table[i + 1]); EXPECT_EQ(ExactHuffmanSize(plain_string), huffman_encoded.size()); @@ -79,10 +79,10 @@ }; // Modify last |test_table| entry to cover all codes. for (size_t i = 0; i != 256; ++i) { - test_table[HTTP2_ARRAYSIZE(test_table) - 1][i] = static_cast<char>(i); + test_table[QUICHE_ARRAYSIZE(test_table) - 1][i] = static_cast<char>(i); } - for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); ++i) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); ++i) { const std::string& plain_string = test_table[i]; std::string huffman_encoded; HuffmanEncode(plain_string, &huffman_encoded);
diff --git a/http2/hpack/varint/hpack_varint_decoder_test.cc b/http2/hpack/varint/hpack_varint_decoder_test.cc index 336349c..6a2cd23 100644 --- a/http2/hpack/varint/hpack_varint_decoder_test.cc +++ b/http2/hpack/varint/hpack_varint_decoder_test.cc
@@ -9,10 +9,10 @@ #include <stddef.h> #include "testing/gtest/include/gtest/gtest.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_arraysize.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" using ::testing::AssertionFailure; @@ -261,7 +261,7 @@ }; TEST_P(HpackVarintDecoderTest, Success) { - for (size_t i = 0; i < HTTP2_ARRAYSIZE(kSuccessTestData); ++i) { + for (size_t i = 0; i < QUICHE_ARRAYSIZE(kSuccessTestData); ++i) { DecodeExpectSuccess(Http2HexDecode(kSuccessTestData[i].data), kSuccessTestData[i].prefix_length, kSuccessTestData[i].expected_value); @@ -302,7 +302,7 @@ {"ff80feffffffffffffff8100", 8}}; TEST_P(HpackVarintDecoderTest, Error) { - for (size_t i = 0; i < HTTP2_ARRAYSIZE(kErrorTestData); ++i) { + for (size_t i = 0; i < QUICHE_ARRAYSIZE(kErrorTestData); ++i) { DecodeExpectError(Http2HexDecode(kErrorTestData[i].data), kErrorTestData[i].prefix_length); }
diff --git a/http2/hpack/varint/hpack_varint_encoder_test.cc b/http2/hpack/varint/hpack_varint_encoder_test.cc index 23c19c4..22de704 100644 --- a/http2/hpack/varint/hpack_varint_encoder_test.cc +++ b/http2/hpack/varint/hpack_varint_encoder_test.cc
@@ -4,8 +4,8 @@ #include "net/third_party/quiche/src/http2/hpack/varint/hpack_varint_encoder.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_arraysize.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "testing/gtest/include/gtest/gtest.h" @@ -30,7 +30,7 @@ // Encode integers that fit in the prefix. TEST(HpackVarintEncoderTest, Short) { - for (size_t i = 0; i < HTTP2_ARRAYSIZE(kShortTestData); ++i) { + for (size_t i = 0; i < QUICHE_ARRAYSIZE(kShortTestData); ++i) { std::string output; HpackVarintEncoder::Encode(kShortTestData[i].high_bits, kShortTestData[i].prefix_length, @@ -103,17 +103,17 @@ TEST(HpackVarintEncoderTest, Long) { // Test encoding byte by byte, also test encoding in // a single ResumeEncoding() call. - for (size_t i = 0; i < HTTP2_ARRAYSIZE(kLongTestData); ++i) { - std::string expected_encoding = - Http2HexDecode(kLongTestData[i].expected_encoding); + for (size_t i = 0; i < QUICHE_ARRAYSIZE(kLongTestData); ++i) { + std::string expected_encoding = + Http2HexDecode(kLongTestData[i].expected_encoding); - std::string output; - HpackVarintEncoder::Encode(kLongTestData[i].high_bits, - kLongTestData[i].prefix_length, - kLongTestData[i].value, &output); + std::string output; + HpackVarintEncoder::Encode(kLongTestData[i].high_bits, + kLongTestData[i].prefix_length, + kLongTestData[i].value, &output); - EXPECT_EQ(expected_encoding, output); - } + EXPECT_EQ(expected_encoding, output); + } } struct { @@ -130,7 +130,7 @@ // Make sure that the encoder outputs the last byte even when it is zero. This // happens exactly when encoding the value 2^prefix_length - 1. TEST(HpackVarintEncoderTest, LastByteIsZero) { - for (size_t i = 0; i < HTTP2_ARRAYSIZE(kLastByteIsZeroTestData); ++i) { + for (size_t i = 0; i < QUICHE_ARRAYSIZE(kLastByteIsZeroTestData); ++i) { std::string output; HpackVarintEncoder::Encode(kLastByteIsZeroTestData[i].high_bits, kLastByteIsZeroTestData[i].prefix_length,
diff --git a/http2/platform/api/http2_arraysize.h b/http2/platform/api/http2_arraysize.h deleted file mode 100644 index 417e53b..0000000 --- a/http2/platform/api/http2_arraysize.h +++ /dev/null
@@ -1,12 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_ARRAYSIZE_H_ -#define QUICHE_HTTP2_PLATFORM_API_HTTP2_ARRAYSIZE_H_ - -#include "net/http2/platform/impl/http2_arraysize_impl.h" - -#define HTTP2_ARRAYSIZE(x) HTTP2_ARRAYSIZE_IMPL(x) - -#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_ARRAYSIZE_H_