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

Side by Side Diff: net/quic/spdy_utils_test.cc

Issue 2081713006: gfe-relnote: Fix an error in QUIC's SpdyUtils where content-length was (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a bug in QUIC's SpdyUtils where >4GB content-lengths failed to parse. Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/quic/spdy_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "net/quic/spdy_utils.h" 4 #include "net/quic/spdy_utils.h"
5 5
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "net/test/gtest_util.h" 9 #include "net/test/gtest_util.h"
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 {"foo", "foovalue"}, 223 {"foo", "foovalue"},
224 {"content-length", "8"}, 224 {"content-length", "8"},
225 {"bar", "barvalue"}, 225 {"bar", "barvalue"},
226 {"baz", ""}}); 226 {"baz", ""}});
227 int64_t content_length = -1; 227 int64_t content_length = -1;
228 SpdyHeaderBlock block; 228 SpdyHeaderBlock block;
229 ASSERT_FALSE( 229 ASSERT_FALSE(
230 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block)); 230 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
231 } 231 }
232 232
233 TEST(SpdyUtilsTest, CopyAndValidateHeadersLargeContentLength) {
234 auto headers = FromList({{"content-length", "9000000000"},
235 {"foo", "foovalue"},
236 {"bar", "barvalue"},
237 {"baz", ""}});
238 int64_t content_length = -1;
239 SpdyHeaderBlock block;
240 ASSERT_TRUE(
241 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
242 EXPECT_THAT(block, UnorderedElementsAre(
243 Pair("foo", "foovalue"), Pair("bar", "barvalue"),
244 Pair("content-length", StringPiece("9000000000")),
245 Pair("baz", "")));
246 EXPECT_EQ(9000000000, content_length);
247 }
248
233 TEST(SpdyUtilsTest, CopyAndValidateHeadersMultipleValues) { 249 TEST(SpdyUtilsTest, CopyAndValidateHeadersMultipleValues) {
234 auto headers = FromList({{"foo", "foovalue"}, 250 auto headers = FromList({{"foo", "foovalue"},
235 {"bar", "barvalue"}, 251 {"bar", "barvalue"},
236 {"baz", ""}, 252 {"baz", ""},
237 {"foo", "boo"}, 253 {"foo", "boo"},
238 {"baz", "buzz"}}); 254 {"baz", "buzz"}});
239 int64_t content_length = -1; 255 int64_t content_length = -1;
240 SpdyHeaderBlock block; 256 SpdyHeaderBlock block;
241 ASSERT_TRUE( 257 ASSERT_TRUE(
242 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block)); 258 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 headers[":scheme"] = "https"; 350 headers[":scheme"] = "https";
335 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 351 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers));
336 headers[":authority"] = "www.google.com"; 352 headers[":authority"] = "www.google.com";
337 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 353 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers));
338 headers[":path"] = "/index.html"; 354 headers[":path"] = "/index.html";
339 EXPECT_TRUE(SpdyUtils::UrlIsValid(headers)); 355 EXPECT_TRUE(SpdyUtils::UrlIsValid(headers));
340 } 356 }
341 357
342 } // namespace test 358 } // namespace test
343 } // namespace net 359 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/spdy_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698