Use QuicheDataReader instead of SpdyFrameReader everywhere.

In order to do that, ReadUInt24() method needs to be copied from SpdyFrameReader
to QuicheDataReader.

PiperOrigin-RevId: 422809480
diff --git a/common/quiche_data_reader.cc b/common/quiche_data_reader.cc
index f20c752..1f948f1 100644
--- a/common/quiche_data_reader.cc
+++ b/common/quiche_data_reader.cc
@@ -9,6 +9,7 @@
 #include "absl/strings/numbers.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
+#include "common/platform/api/quiche_bug_tracker.h"
 #include "common/platform/api/quiche_logging.h"
 #include "common/quiche_endian.h"
 
@@ -40,6 +41,21 @@
   return true;
 }
 
+bool QuicheDataReader::ReadUInt24(uint32_t* result) {
+  if (endianness_ != quiche::NETWORK_BYTE_ORDER) {
+    // TODO(b/214573190): Implement and test HOST_BYTE_ORDER case.
+    QUICHE_BUG(QuicheDataReader_ReadUInt24_NotImplemented);
+    return false;
+  }
+
+  *result = 0;
+  if (!ReadBytes(reinterpret_cast<char*>(result) + 1, 3u)) {
+    return false;
+  }
+  *result = quiche::QuicheEndian::NetToHost32(*result);
+  return true;
+}
+
 bool QuicheDataReader::ReadUInt32(uint32_t* result) {
   if (!ReadBytes(result, sizeof(*result))) {
     return false;
diff --git a/common/quiche_data_reader.h b/common/quiche_data_reader.h
index 833198d..ae8bbcf 100644
--- a/common/quiche_data_reader.h
+++ b/common/quiche_data_reader.h
@@ -45,11 +45,12 @@
   // Empty destructor.
   ~QuicheDataReader() {}
 
-  // Reads an 8/16/32/64-bit unsigned integer into the given output
+  // Reads an 8/16/24/32/64-bit unsigned integer into the given output
   // parameter. Forwards the internal iterator on success. Returns true on
   // success, false otherwise.
   bool ReadUInt8(uint8_t* result);
   bool ReadUInt16(uint16_t* result);
+  bool ReadUInt24(uint32_t* result);
   bool ReadUInt32(uint32_t* result);
   bool ReadUInt64(uint64_t* result);
 
diff --git a/http2/adapter/test_utils.cc b/http2/adapter/test_utils.cc
index 210cb66..d56acda 100644
--- a/http2/adapter/test_utils.cc
+++ b/http2/adapter/test_utils.cc
@@ -4,9 +4,8 @@
 
 #include "absl/strings/str_format.h"
 #include "http2/adapter/http2_visitor_interface.h"
-#include "common/quiche_endian.h"
+#include "common/quiche_data_reader.h"
 #include "spdy/core/hpack/hpack_encoder.h"
-#include "spdy/core/spdy_frame_reader.h"
 
 namespace http2 {
 namespace adapter {
@@ -137,7 +136,7 @@
 
   bool MatchAndExplain(absl::string_view s,
                        testing::MatchResultListener* listener) const override {
-    spdy::SpdyFrameReader reader(s.data(), s.size());
+    quiche::QuicheDataReader reader(s.data(), s.size());
 
     for (TypeAndOptionalLength expected : expected_types_and_lengths_) {
       if (!MatchAndExplainOneFrame(expected.first, expected.second, &reader,
@@ -146,8 +145,7 @@
       }
     }
     if (!reader.IsDoneReading()) {
-      size_t bytes_remaining = s.size() - reader.GetBytesConsumed();
-      *listener << "; " << bytes_remaining << " bytes left to read!";
+      *listener << "; " << reader.BytesRemaining() << " bytes left to read!";
       return false;
     }
     return true;
@@ -155,7 +153,7 @@
 
   bool MatchAndExplainOneFrame(spdy::SpdyFrameType expected_type,
                                absl::optional<size_t> expected_length,
-                               spdy::SpdyFrameReader* reader,
+                               quiche::QuicheDataReader* reader,
                                testing::MatchResultListener* listener) const {
     uint32_t payload_length;
     if (!reader->ReadUInt24(&payload_length)) {