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/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);