Remove SPDY_ARRAYSIZE; use QUICHE_ARRAYSIZE instead. gfe-relnote: n/a, no functional change. PiperOrigin-RevId: 285457937 Change-Id: Ic8d9322ba3e544c6a47274971b7e7e7418255fcd
diff --git a/spdy/core/hpack/hpack_constants.cc b/spdy/core/hpack/hpack_constants.cc index 77cae3a..71ac139 100644 --- a/spdy/core/hpack/hpack_constants.cc +++ b/spdy/core/hpack/hpack_constants.cc
@@ -8,9 +8,9 @@ #include <memory> #include <vector> +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_arraysize.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" namespace spdy { @@ -290,7 +290,7 @@ // The "constructor" for a HpackStaticEntry that computes the lengths at // compile time. #define STATIC_ENTRY(name, value) \ - { name, SPDY_ARRAYSIZE(name) - 1, value, SPDY_ARRAYSIZE(value) - 1 } + { name, QUICHE_ARRAYSIZE(name) - 1, value, QUICHE_ARRAYSIZE(value) - 1 } const std::vector<HpackStaticEntry>& HpackStaticTableVector() { static const auto* kHpackStaticTable = new std::vector<HpackStaticEntry>{
diff --git a/spdy/core/hpack/hpack_decoder_adapter_test.cc b/spdy/core/hpack/hpack_decoder_adapter_test.cc index da3a56c..73c33eb 100644 --- a/spdy/core/hpack/hpack_decoder_adapter_test.cc +++ b/spdy/core/hpack/hpack_decoder_adapter_test.cc
@@ -17,11 +17,11 @@ #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_tables.h" #include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h" #include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_arraysize.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -613,7 +613,7 @@ // name. const char input[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2"; const SpdyHeaderBlock& header_set = DecodeBlockExpectingSuccess( - SpdyStringPiece(input, SPDY_ARRAYSIZE(input) - 1)); + SpdyStringPiece(input, QUICHE_ARRAYSIZE(input) - 1)); SpdyHeaderBlock expected_header_set; expected_header_set[":path"] = "/sample/path"; @@ -626,7 +626,7 @@ TEST_P(HpackDecoderAdapterTest, LiteralHeaderIncrementalIndexing) { const char input[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2"; const SpdyHeaderBlock& header_set = DecodeBlockExpectingSuccess( - SpdyStringPiece(input, SPDY_ARRAYSIZE(input) - 1)); + SpdyStringPiece(input, QUICHE_ARRAYSIZE(input) - 1)); SpdyHeaderBlock expected_header_set; expected_header_set[":path"] = "/sample/path";
diff --git a/spdy/core/hpack/hpack_huffman_table_test.cc b/spdy/core/hpack/hpack_huffman_table_test.cc index de4d30c..bc38f6d 100644 --- a/spdy/core/hpack/hpack_huffman_table_test.cc +++ b/spdy/core/hpack/hpack_huffman_table_test.cc
@@ -8,9 +8,9 @@ #include <utility> #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_arraysize.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -69,7 +69,7 @@ {0b11000000000000000000000000000000, 3, 6}, {0b11100000000000000000000000000000, 8, 7}}; HpackHuffmanTable table; - EXPECT_TRUE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_TRUE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); } { // But using 2 bits with one symbol overflows the code. @@ -83,7 +83,7 @@ {0b11100000000000000000000000000000, 3, 6}, {0b00000000000000000000000000000000, 8, 7}}; // Overflow. HpackHuffmanTable table; - EXPECT_FALSE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); EXPECT_EQ(7, HpackHuffmanTablePeer(table).failed_symbol_id()); } { @@ -93,7 +93,7 @@ {0b11000000000000000000000000000000, 3, 2}, {0b11100000000000000000000000000000, 8, 3}}; HpackHuffmanTable table; - EXPECT_TRUE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_TRUE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); } { // But repeating a length overflows the code. @@ -103,7 +103,7 @@ {0b11000000000000000000000000000000, 2, 2}, {0b00000000000000000000000000000000, 8, 3}}; // Overflow. HpackHuffmanTable table; - EXPECT_FALSE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); EXPECT_EQ(3, HpackHuffmanTablePeer(table).failed_symbol_id()); } { @@ -114,7 +114,7 @@ {0b11000000000000000000000000000000, 3, 1}, // Repeat. {0b11100000000000000000000000000000, 8, 3}}; HpackHuffmanTable table; - EXPECT_FALSE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); EXPECT_EQ(2, HpackHuffmanTablePeer(table).failed_symbol_id()); } { @@ -124,7 +124,7 @@ {0b10100000000000000000000000000000, 4, 2}, {0b10110000000000000000000000000000, 8, 3}}; HpackHuffmanTable table; - EXPECT_FALSE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); EXPECT_EQ(0, HpackHuffmanTablePeer(table).failed_symbol_id()); } { @@ -135,7 +135,7 @@ {0b11000000000000000000000000000000, 2, 2}, // Code not canonical. {0b10000000000000000000000000000000, 8, 3}}; HpackHuffmanTable table; - EXPECT_FALSE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); EXPECT_EQ(2, HpackHuffmanTablePeer(table).failed_symbol_id()); } { @@ -145,7 +145,7 @@ {0b11000000000000000000000000000000, 3, 2}, {0b11100000000000000000000000000000, 7, 3}}; HpackHuffmanTable table; - EXPECT_FALSE(table.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code))); } } @@ -159,11 +159,11 @@ {0b10001000000000000000000000000000, 5, 5}, // 6th. {0b10011000000000000000000000000000, 8, 6}, // 8th. {0b10010000000000000000000000000000, 5, 7}}; // 7th. - EXPECT_TRUE(table_.Initialize(code, SPDY_ARRAYSIZE(code))); + EXPECT_TRUE(table_.Initialize(code, QUICHE_ARRAYSIZE(code))); - ASSERT_EQ(SPDY_ARRAYSIZE(code), peer_.code_by_id().size()); - ASSERT_EQ(SPDY_ARRAYSIZE(code), peer_.length_by_id().size()); - for (size_t i = 0; i < SPDY_ARRAYSIZE(code); ++i) { + ASSERT_EQ(QUICHE_ARRAYSIZE(code), peer_.code_by_id().size()); + ASSERT_EQ(QUICHE_ARRAYSIZE(code), peer_.length_by_id().size()); + for (size_t i = 0; i < QUICHE_ARRAYSIZE(code); ++i) { EXPECT_EQ(code[i].code, peer_.code_by_id()[i]); EXPECT_EQ(code[i].length, peer_.length_by_id()[i]); } @@ -171,10 +171,10 @@ EXPECT_EQ(0b10011000, peer_.pad_bits()); char input_storage[] = {2, 3, 2, 7, 4}; - SpdyStringPiece input(input_storage, SPDY_ARRAYSIZE(input_storage)); + SpdyStringPiece input(input_storage, QUICHE_ARRAYSIZE(input_storage)); // By symbol: (2) 00 (3) 010 (2) 00 (7) 10010 (4) 10000 (6 as pad) 1001100. char expect_storage[] = {0b00010001, 0b00101000, 0b01001100}; - SpdyStringPiece expect(expect_storage, SPDY_ARRAYSIZE(expect_storage)); + SpdyStringPiece expect(expect_storage, QUICHE_ARRAYSIZE(expect_storage)); EXPECT_EQ(expect, EncodeString(input)); } @@ -213,7 +213,7 @@ "custom-value", }; // Round-trip each test example. - for (size_t i = 0; i != SPDY_ARRAYSIZE(test_table); i += 2) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) { const std::string& encodedFixture(test_table[i]); const std::string& decodedFixture(test_table[i + 1]); DecodeString(encodedFixture, &buffer); @@ -242,7 +242,7 @@ "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", }; // Round-trip each test example. - for (size_t i = 0; i != SPDY_ARRAYSIZE(test_table); i += 2) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) { const std::string& encodedFixture(test_table[i]); const std::string& decodedFixture(test_table[i + 1]); DecodeString(encodedFixture, &buffer); @@ -256,7 +256,7 @@ for (size_t i = 0; i != 256; i++) { char c = static_cast<char>(i); char storage[3] = {c, c, c}; - SpdyStringPiece input(storage, SPDY_ARRAYSIZE(storage)); + SpdyStringPiece input(storage, QUICHE_ARRAYSIZE(storage)); std::string buffer_in = EncodeString(input); std::string buffer_out; DecodeString(buffer_in, &buffer_out); @@ -270,7 +270,7 @@ storage[i] = static_cast<char>(i); storage[511 - i] = static_cast<char>(i); } - SpdyStringPiece input(storage, SPDY_ARRAYSIZE(storage)); + SpdyStringPiece input(storage, QUICHE_ARRAYSIZE(storage)); std::string buffer_in = EncodeString(input); std::string buffer_out; DecodeString(buffer_in, &buffer_out); @@ -289,12 +289,12 @@ }; for (size_t i = 0; i != 256; ++i) { // Expand last |test_table| entry to cover all codes. - test_table[SPDY_ARRAYSIZE(test_table) - 1][i] = static_cast<char>(i); + test_table[QUICHE_ARRAYSIZE(test_table) - 1][i] = static_cast<char>(i); } HpackOutputStream output_stream; std::string encoding; - for (size_t i = 0; i != SPDY_ARRAYSIZE(test_table); ++i) { + for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); ++i) { table_.EncodeString(test_table[i], &output_stream); output_stream.TakeString(&encoding); EXPECT_EQ(encoding.size(), table_.EncodedSize(test_table[i]));
diff --git a/spdy/core/spdy_frame_reader_test.cc b/spdy/core/spdy_frame_reader_test.cc index 92c8e9b..c1ab02e 100644 --- a/spdy/core/spdy_frame_reader_test.cc +++ b/spdy/core/spdy_frame_reader_test.cc
@@ -6,7 +6,7 @@ #include <cstdint> -#include "net/third_party/quiche/src/spdy/platform/api/spdy_arraysize.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -41,7 +41,7 @@ }; SpdyFrameReader frame_reader(reinterpret_cast<const char*>(kFrameData), - SPDY_ARRAYSIZE(kFrameData) * sizeof(uint32_t)); + QUICHE_ARRAYSIZE(kFrameData) * sizeof(uint32_t)); EXPECT_FALSE(frame_reader.IsDoneReading()); uint32_t uint32_val; @@ -64,7 +64,7 @@ 0x20, 0x31, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x33, // "Testing, 1, 2, 3" }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); SpdyStringPiece stringpiece_val; @@ -87,7 +87,7 @@ 0x20, 0x34, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x36, // "Testing, 4, 5, 6" }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); SpdyStringPiece stringpiece_val; @@ -106,7 +106,7 @@ 0x00, // part of a uint16_t }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); uint16_t uint16_val; @@ -119,7 +119,7 @@ 0x00, 0x00, 0x00, // part of a uint32_t }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); uint32_t uint32_val; @@ -139,7 +139,7 @@ 0x48, 0x69, // "Hi" }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); SpdyStringPiece stringpiece_val; @@ -158,7 +158,7 @@ 0x00, // part of a uint16_t }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); SpdyStringPiece stringpiece_val; @@ -178,7 +178,7 @@ 0x48, 0x69, // "Hi" }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); SpdyStringPiece stringpiece_val; @@ -197,7 +197,7 @@ 0x00, 0x00, 0x00, // part of a uint32_t }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); SpdyStringPiece stringpiece_val; @@ -216,18 +216,18 @@ 0x48, 0x69, // "Hi" }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); char dest1[3] = {}; - EXPECT_TRUE(frame_reader.ReadBytes(&dest1, SPDY_ARRAYSIZE(dest1))); + EXPECT_TRUE(frame_reader.ReadBytes(&dest1, QUICHE_ARRAYSIZE(dest1))); EXPECT_FALSE(frame_reader.IsDoneReading()); - EXPECT_EQ("foo", SpdyStringPiece(dest1, SPDY_ARRAYSIZE(dest1))); + EXPECT_EQ("foo", SpdyStringPiece(dest1, QUICHE_ARRAYSIZE(dest1))); char dest2[2] = {}; - EXPECT_TRUE(frame_reader.ReadBytes(&dest2, SPDY_ARRAYSIZE(dest2))); + EXPECT_TRUE(frame_reader.ReadBytes(&dest2, QUICHE_ARRAYSIZE(dest2))); EXPECT_TRUE(frame_reader.IsDoneReading()); - EXPECT_EQ("Hi", SpdyStringPiece(dest2, SPDY_ARRAYSIZE(dest2))); + EXPECT_EQ("Hi", SpdyStringPiece(dest2, QUICHE_ARRAYSIZE(dest2))); } TEST(SpdyFrameReaderTest, ReadBytesWithBufferTooSmall) { @@ -236,11 +236,11 @@ 0x01, }; - SpdyFrameReader frame_reader(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_FALSE(frame_reader.IsDoneReading()); - char dest[SPDY_ARRAYSIZE(kFrameData) + 2] = {}; - EXPECT_FALSE(frame_reader.ReadBytes(&dest, SPDY_ARRAYSIZE(kFrameData) + 1)); + char dest[QUICHE_ARRAYSIZE(kFrameData) + 2] = {}; + EXPECT_FALSE(frame_reader.ReadBytes(&dest, QUICHE_ARRAYSIZE(kFrameData) + 1)); EXPECT_STREQ("", dest); }
diff --git a/spdy/core/spdy_framer_test.cc b/spdy/core/spdy_framer_test.cc index 63a16f4..dd9f150 100644 --- a/spdy/core/spdy_framer_test.cc +++ b/spdy/core/spdy_framer_test.cc
@@ -13,6 +13,7 @@ #include <utility> #include <vector> +#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" #include "net/third_party/quiche/src/spdy/core/array_output_buffer.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h" @@ -21,7 +22,6 @@ #include "net/third_party/quiche/src/spdy/core/spdy_frame_reader.h" #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" #include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_arraysize.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_flags.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" @@ -1315,7 +1315,7 @@ const char bytes[] = "this is a test test test test test!"; SpdyDataIR data_ir(/* stream_id = */ 1, - SpdyStringPiece(bytes, SPDY_ARRAYSIZE(bytes))); + SpdyStringPiece(bytes, QUICHE_ARRAYSIZE(bytes))); data_ir.set_fin(true); SpdySerializedFrame send_frame(framer_.SerializeData(data_ir)); @@ -1335,7 +1335,8 @@ EXPECT_EQ(0, visitor.error_count_); EXPECT_EQ(1, visitor.headers_frame_count_); - EXPECT_EQ(SPDY_ARRAYSIZE(bytes), static_cast<unsigned>(visitor.data_bytes_)); + EXPECT_EQ(QUICHE_ARRAYSIZE(bytes), + static_cast<unsigned>(visitor.data_bytes_)); EXPECT_EQ(0, visitor.fin_frame_count_); EXPECT_EQ(0, visitor.fin_flag_count_); EXPECT_EQ(1, visitor.end_of_stream_count_); @@ -1360,7 +1361,8 @@ 0x12, 0x34, 0x56, 0x78, // Increment: 305419896 }; - CompareFrame(kDescription, frame, kH2FrameData, SPDY_ARRAYSIZE(kH2FrameData)); + CompareFrame(kDescription, frame, kH2FrameData, + QUICHE_ARRAYSIZE(kH2FrameData)); } TEST_P(SpdyFramerTest, CreateDataFrame) { @@ -1381,7 +1383,7 @@ SpdyDataIR data_ir(/* stream_id = */ 1, bytes); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); SpdyDataIR data_header_ir(/* stream_id = */ 1); data_header_ir.SetDataShallow(bytes); @@ -1437,7 +1439,7 @@ data_ir.set_padding_len(248); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir); CompareCharArraysWithHexError( @@ -1467,7 +1469,7 @@ data_ir.set_padding_len(8); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir); CompareCharArraysWithHexError( @@ -1497,7 +1499,7 @@ data_ir.set_padding_len(1); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir); CompareCharArraysWithHexError( @@ -1517,7 +1519,7 @@ SpdyDataIR data_ir(/* stream_id = */ 1, "\xff"); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1534,7 +1536,7 @@ data_ir.set_fin(true); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1548,7 +1550,7 @@ SpdyDataIR data_ir(/* stream_id = */ 1, ""); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir); CompareCharArraysWithHexError( @@ -1570,7 +1572,7 @@ data_ir.set_fin(true); SpdySerializedFrame frame(framer_.SerializeData(data_ir)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } } @@ -1591,7 +1593,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1612,7 +1614,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1633,7 +1635,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } } @@ -1661,7 +1663,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1697,7 +1699,7 @@ } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1717,7 +1719,7 @@ } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } } @@ -1750,7 +1752,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); // Tests SpdyPingIR when the ping is an ack. ping_ir.set_is_ack(true); @@ -1761,7 +1763,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameDataWithAck, - SPDY_ARRAYSIZE(kH2FrameDataWithAck)); + QUICHE_ARRAYSIZE(kH2FrameDataWithAck)); } } @@ -1785,7 +1787,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1808,7 +1810,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } } @@ -1843,7 +1845,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1875,7 +1877,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1907,7 +1909,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers_ir, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1944,7 +1946,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers_ir, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -1984,7 +1986,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers_ir, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kV4FrameData, - SPDY_ARRAYSIZE(kV4FrameData)); + QUICHE_ARRAYSIZE(kV4FrameData)); } { @@ -2024,7 +2026,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers_ir, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kV4FrameData, - SPDY_ARRAYSIZE(kV4FrameData)); + QUICHE_ARRAYSIZE(kV4FrameData)); } { @@ -2062,7 +2064,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders( &framer, headers_ir, use_output_ ? &output_ : nullptr)); CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } } @@ -2085,7 +2087,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -2107,7 +2109,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } { @@ -2129,7 +2131,7 @@ frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } CompareFrame(kDescription, frame, kH2FrameData, - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); } } @@ -2167,7 +2169,7 @@ push_promise.SetHeader("foo", "bar"); SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise( &framer, push_promise, use_output_ ? &output_ : nullptr)); - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } { @@ -2207,7 +2209,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise( &framer, push_promise, use_output_ ? &output_ : nullptr)); - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } { @@ -2267,7 +2269,7 @@ SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise( &framer, push_promise, use_output_ ? &output_ : nullptr)); - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } } @@ -2321,7 +2323,7 @@ ASSERT_TRUE(framer.SerializeContinuation(continuation, &output_)); frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } // Test that if we send an unexpected CONTINUATION @@ -2453,16 +2455,17 @@ // Partially compare the PUSH_PROMISE frame against the template. const unsigned char* frame_data = reinterpret_cast<const unsigned char*>(frame.data()); - CompareCharArraysWithHexError(kDescription, frame_data, - SPDY_ARRAYSIZE(kPartialPushPromiseFrameData), - kPartialPushPromiseFrameData, - SPDY_ARRAYSIZE(kPartialPushPromiseFrameData)); + CompareCharArraysWithHexError( + kDescription, frame_data, + QUICHE_ARRAYSIZE(kPartialPushPromiseFrameData), + kPartialPushPromiseFrameData, + QUICHE_ARRAYSIZE(kPartialPushPromiseFrameData)); // Compare the CONTINUATION frame against the template. frame_data += kHttp2MaxControlFrameSendSize; CompareCharArraysWithHexError( - kDescription, frame_data, SPDY_ARRAYSIZE(kContinuationFrameData), - kContinuationFrameData, SPDY_ARRAYSIZE(kContinuationFrameData)); + kDescription, frame_data, QUICHE_ARRAYSIZE(kContinuationFrameData), + kContinuationFrameData, QUICHE_ARRAYSIZE(kContinuationFrameData)); } } @@ -2489,7 +2492,7 @@ EXPECT_EQ(framer_.SerializeFrame(altsvc_ir, &output_), frame.size()); frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } TEST_P(SpdyFramerTest, CreatePriority) { @@ -2511,7 +2514,7 @@ EXPECT_EQ(framer_.SerializeFrame(priority_ir, &output_), frame.size()); frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } TEST_P(SpdyFramerTest, CreateUnknown) { @@ -2538,7 +2541,7 @@ EXPECT_EQ(framer_.SerializeFrame(unknown_ir, &output_), frame.size()); frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } // Test serialization of a SpdyUnknownIR with a defined type, a length field @@ -2570,7 +2573,7 @@ EXPECT_EQ(framer_.SerializeFrame(unknown_ir, &output_), frame.size()); frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false); } - CompareFrame(kDescription, frame, kFrameData, SPDY_ARRAYSIZE(kFrameData)); + CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData)); } TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) { @@ -3606,7 +3609,7 @@ // Simulate the case where the stream id validation checks out. visitor.on_unknown_frame_result_ = true; - visitor.SimulateInFramer(unknown_frame, SPDY_ARRAYSIZE(unknown_frame)); + visitor.SimulateInFramer(unknown_frame, QUICHE_ARRAYSIZE(unknown_frame)); EXPECT_EQ(0, visitor.error_count_); // Follow it up with a valid control frame to make sure we handle @@ -3642,7 +3645,7 @@ TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION); TestExtension extension; visitor.set_extension_visitor(&extension); - visitor.SimulateInFramer(unknown_frame, SPDY_ARRAYSIZE(unknown_frame)); + visitor.SimulateInFramer(unknown_frame, QUICHE_ARRAYSIZE(unknown_frame)); EXPECT_EQ(0, visitor.error_count_); EXPECT_EQ(0x7fffffffu, extension.stream_id_); EXPECT_EQ(20u, extension.length_); @@ -3673,7 +3676,7 @@ 0xff, 0xff, 0xff, 0xff, // }; TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION); - visitor.SimulateInFramer(kFrameData, SPDY_ARRAYSIZE(kFrameData)); + visitor.SimulateInFramer(kFrameData, QUICHE_ARRAYSIZE(kFrameData)); EXPECT_EQ(1, visitor.error_count_); } @@ -3692,7 +3695,7 @@ }; TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION); - visitor.SimulateInFramer(kInput, SPDY_ARRAYSIZE(kInput)); + visitor.SimulateInFramer(kInput, QUICHE_ARRAYSIZE(kInput)); EXPECT_EQ(1, visitor.error_count_); } @@ -4217,7 +4220,7 @@ EXPECT_CALL(visitor, OnRstStream(1, ERROR_CODE_NO_ERROR)); deframer_.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamInvalid), - SPDY_ARRAYSIZE(kH2RstStreamInvalid)); + QUICHE_ARRAYSIZE(kH2RstStreamInvalid)); EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state()); EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error()) << Http2DecoderAdapter::SpdyFramerErrorToString( @@ -4227,7 +4230,7 @@ EXPECT_CALL(visitor, OnRstStream(1, ERROR_CODE_INTERNAL_ERROR)); deframer_.ProcessInput( reinterpret_cast<const char*>(kH2RstStreamNumStatusCodes), - SPDY_ARRAYSIZE(kH2RstStreamNumStatusCodes)); + QUICHE_ARRAYSIZE(kH2RstStreamNumStatusCodes)); EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state()); EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error()) << Http2DecoderAdapter::SpdyFramerErrorToString( @@ -4250,7 +4253,7 @@ EXPECT_CALL(visitor, OnGoAway(1, ERROR_CODE_INTERNAL_ERROR)); deframer_.ProcessInput(reinterpret_cast<const char*>(kH2FrameData), - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state()); EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error()) << Http2DecoderAdapter::SpdyFramerErrorToString( @@ -4274,7 +4277,7 @@ EXPECT_CALL(visitor, OnGoAway(0x7fffffff, ERROR_CODE_NO_ERROR)); deframer_.ProcessInput(reinterpret_cast<const char*>(kH2FrameData), - SPDY_ARRAYSIZE(kH2FrameData)); + QUICHE_ARRAYSIZE(kH2FrameData)); EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state()); EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error()) << Http2DecoderAdapter::SpdyFramerErrorToString( @@ -4766,7 +4769,7 @@ SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION); const char bytes[] = "this is a very short data frame"; - SpdyDataIR data_ir(1, SpdyStringPiece(bytes, SPDY_ARRAYSIZE(bytes))); + SpdyDataIR data_ir(1, SpdyStringPiece(bytes, QUICHE_ARRAYSIZE(bytes))); CheckFrameAndIRSize(&data_ir, &framer, &output_); SpdyRstStreamIR rst_ir(/* stream_id = */ 1, ERROR_CODE_PROTOCOL_ERROR);