Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: net/quic/core/spdy_utils_test.cc

Issue 2850513002: Delete QUIC/SPDY utility methods for parsing headers/trailers. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/spdy_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/spdy_utils_test.cc
diff --git a/net/quic/core/spdy_utils_test.cc b/net/quic/core/spdy_utils_test.cc
index 42200f2732f4e8e9edfc0621f671cbb4982bdbb6..d1149d4364f92f30ebf0f34dad834b3e017b4bf1 100644
--- a/net/quic/core/spdy_utils_test.cc
+++ b/net/quic/core/spdy_utils_test.cc
@@ -16,134 +16,6 @@ using testing::Pair;
namespace net {
namespace test {
-TEST(SpdyUtilsTest, SerializeAndParseHeaders) {
- // Creates a SpdyHeaderBlock with some key->value pairs, serializes it, then
- // parses the serialized output and verifies that the end result is the same
- // as the headers that the test started with.
-
- SpdyHeaderBlock input_headers;
- input_headers[":pseudo1"] = "pseudo value1";
- input_headers[":pseudo2"] = "pseudo value2";
- input_headers["key1"] = "value1";
- const int64_t kContentLength = 1234;
- input_headers["content-length"] =
- QuicTextUtils::Uint64ToString(kContentLength);
- input_headers["key2"] = "value2";
-
- // Serialize the header block.
- string serialized_headers =
- SpdyUtils::SerializeUncompressedHeaders(input_headers);
-
- // Take the serialized header block, and parse back into SpdyHeaderBlock.
- SpdyHeaderBlock output_headers;
- int64_t content_length = -1;
- ASSERT_TRUE(SpdyUtils::ParseHeaders(serialized_headers.data(),
- serialized_headers.size(),
- &content_length, &output_headers));
-
- // Should be back to the original headers.
- EXPECT_EQ(content_length, kContentLength);
- EXPECT_EQ(output_headers, input_headers);
-}
-
-TEST(SpdyUtilsTest, SerializeAndParseHeadersLargeContentLength) {
- // Creates a SpdyHeaderBlock with some key->value pairs, serializes it, then
- // parses the serialized output and verifies that the end result is the same
- // as the headers that the test started with.
-
- SpdyHeaderBlock input_headers;
- input_headers[":pseudo1"] = "pseudo value1";
- input_headers[":pseudo2"] = "pseudo value2";
- input_headers["key1"] = "value1";
- const int64_t kContentLength = 12345678900;
- input_headers["content-length"] =
- QuicTextUtils::Uint64ToString(kContentLength);
- input_headers["key2"] = "value2";
-
- // Serialize the header block.
- string serialized_headers =
- SpdyUtils::SerializeUncompressedHeaders(input_headers);
-
- // Take the serialized header block, and parse back into SpdyHeaderBlock.
- SpdyHeaderBlock output_headers;
- int64_t content_length = -1;
- ASSERT_TRUE(SpdyUtils::ParseHeaders(serialized_headers.data(),
- serialized_headers.size(),
- &content_length, &output_headers));
-
- // Should be back to the original headers.
- EXPECT_EQ(content_length, kContentLength);
- EXPECT_EQ(output_headers, input_headers);
-}
-
-TEST(SpdyUtilsTest, SerializeAndParseValidTrailers) {
- // Creates a SpdyHeaderBlock with some valid Trailers key->value pairs,
- // serializes it, then parses the serialized output and verifies that the end
- // result is the same as the trailers that the test started with.
- SpdyHeaderBlock input_trailers;
- const size_t kFinalOffset = 5678;
- input_trailers[kFinalOffsetHeaderKey] =
- QuicTextUtils::Uint64ToString(kFinalOffset);
- input_trailers["key1"] = "value1";
- input_trailers["key2"] = "value2";
-
- // Serialize the trailers.
- string serialized_trailers =
- SpdyUtils::SerializeUncompressedHeaders(input_trailers);
-
- // Take the serialized trailers, and parse back into a SpdyHeaderBlock.
- SpdyHeaderBlock output_trailers;
- size_t final_byte_offset = 0;
- EXPECT_TRUE(SpdyUtils::ParseTrailers(serialized_trailers.data(),
- serialized_trailers.size(),
- &final_byte_offset, &output_trailers));
-
- // Should be back to the original trailers, without the final offset header.
- EXPECT_EQ(final_byte_offset, kFinalOffset);
- input_trailers.erase(kFinalOffsetHeaderKey);
- EXPECT_EQ(output_trailers, input_trailers);
-}
-
-TEST(SpdyUtilsTest, SerializeAndParseTrailersWithoutFinalOffset) {
- // Verifies that parsing fails if Trailers are missing a final offset header.
-
- SpdyHeaderBlock input_trailers;
- input_trailers["key1"] = "value1";
- input_trailers["key2"] = "value2";
-
- // Serialize the trailers.
- string serialized_trailers =
- SpdyUtils::SerializeUncompressedHeaders(input_trailers);
-
- // Parsing the serialized trailers fails because of the missing final offset.
- SpdyHeaderBlock output_trailers;
- size_t final_byte_offset = 0;
- EXPECT_FALSE(SpdyUtils::ParseTrailers(serialized_trailers.data(),
- serialized_trailers.size(),
- &final_byte_offset, &output_trailers));
- EXPECT_EQ(final_byte_offset, 0u);
-}
-
-TEST(SpdyUtilsTest, SerializeAndParseTrailersWithPseudoHeaders) {
- // Verifies that parsing fails if Trailers include pseudo-headers.
-
- SpdyHeaderBlock input_trailers;
- input_trailers[kFinalOffsetHeaderKey] = "12345";
- input_trailers[":disallowed-pseudo-header"] = "pseudo value";
- input_trailers["key1"] = "value1";
- input_trailers["key2"] = "value2";
-
- // Serialize the trailers.
- string serialized_trailers =
- SpdyUtils::SerializeUncompressedHeaders(input_trailers);
-
- // Parsing the serialized trailers fails because of the extra pseudo header.
- SpdyHeaderBlock output_trailers;
- size_t final_byte_offset = 0;
- EXPECT_FALSE(SpdyUtils::ParseTrailers(serialized_trailers.data(),
- serialized_trailers.size(),
- &final_byte_offset, &output_trailers));
-}
static std::unique_ptr<QuicHeaderList> FromList(
const QuicHeaderList::ListType& src) {
std::unique_ptr<QuicHeaderList> headers(new QuicHeaderList);
« no previous file with comments | « net/quic/core/spdy_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698