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

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

Issue 2107923002: m[52] relnote: Fix an error in QUIC's SpdyUtils where content-length was being parsed as an int in … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 {"foo", "foovalue"}, 178 {"foo", "foovalue"},
179 {"content-length", "8"}, 179 {"content-length", "8"},
180 {"bar", "barvalue"}, 180 {"bar", "barvalue"},
181 {"baz", ""}}); 181 {"baz", ""}});
182 int64_t content_length = -1; 182 int64_t content_length = -1;
183 SpdyHeaderBlock block; 183 SpdyHeaderBlock block;
184 ASSERT_FALSE( 184 ASSERT_FALSE(
185 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block)); 185 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
186 } 186 }
187 187
188 TEST(SpdyUtilsTest, CopyAndValidateHeadersLargeContentLength) {
189 auto headers = FromList({{"content-length", "9000000000"},
190 {"foo", "foovalue"},
191 {"bar", "barvalue"},
192 {"baz", ""}});
193 int64_t content_length = -1;
194 SpdyHeaderBlock block;
195 ASSERT_TRUE(
196 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
197 EXPECT_THAT(block, UnorderedElementsAre(
198 Pair("foo", "foovalue"), Pair("bar", "barvalue"),
199 Pair("content-length", StringPiece("9000000000")),
200 Pair("baz", "")));
201 EXPECT_EQ(9000000000, content_length);
202 }
203
188 TEST(SpdyUtilsTest, CopyAndValidateHeadersMultipleValues) { 204 TEST(SpdyUtilsTest, CopyAndValidateHeadersMultipleValues) {
189 auto headers = FromList({{"foo", "foovalue"}, 205 auto headers = FromList({{"foo", "foovalue"},
190 {"bar", "barvalue"}, 206 {"bar", "barvalue"},
191 {"baz", ""}, 207 {"baz", ""},
192 {"foo", "boo"}, 208 {"foo", "boo"},
193 {"baz", "buzz"}}); 209 {"baz", "buzz"}});
194 int64_t content_length = -1; 210 int64_t content_length = -1;
195 SpdyHeaderBlock block; 211 SpdyHeaderBlock block;
196 ASSERT_TRUE( 212 ASSERT_TRUE(
197 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block)); 213 SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 headers[":scheme"] = "https"; 291 headers[":scheme"] = "https";
276 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 292 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers));
277 headers[":authority"] = "www.google.com"; 293 headers[":authority"] = "www.google.com";
278 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 294 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers));
279 headers[":path"] = "/index.html"; 295 headers[":path"] = "/index.html";
280 EXPECT_TRUE(SpdyUtils::UrlIsValid(headers)); 296 EXPECT_TRUE(SpdyUtils::UrlIsValid(headers));
281 } 297 }
282 298
283 } // namespace test 299 } // namespace test
284 } // namespace net 300 } // 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