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

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

Issue 2363393004: Remove usage of BalsaHeaders from QuicClient. Also move QuicDataToResend from QuicClient to QuicCli… (Closed)
Patch Set: Fix win Created 4 years, 2 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/core/spdy_utils.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | 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/core/spdy_utils.h" 4 #include "net/quic/core/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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 headers["key2"] = "value2"; 346 headers["key2"] = "value2";
347 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "www.google.com"); 347 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "www.google.com");
348 headers[":authority"] = "www.google.com:6666"; 348 headers[":authority"] = "www.google.com:6666";
349 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "www.google.com"); 349 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "www.google.com");
350 headers[":authority"] = "192.168.1.1"; 350 headers[":authority"] = "192.168.1.1";
351 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "192.168.1.1"); 351 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "192.168.1.1");
352 headers[":authority"] = "192.168.1.1:6666"; 352 headers[":authority"] = "192.168.1.1:6666";
353 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "192.168.1.1"); 353 EXPECT_EQ(SpdyUtils::GetHostNameFromHeaderBlock(headers), "192.168.1.1");
354 } 354 }
355 355
356 TEST(SpdyUtilsTest, UrlIsValid) { 356 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrl) {
357 string url = "https://www.google.com/index.html";
357 SpdyHeaderBlock headers; 358 SpdyHeaderBlock headers;
358 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 359 EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers));
359 headers[":scheme"] = "https"; 360 EXPECT_EQ("https", headers[":scheme"].as_string());
360 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 361 EXPECT_EQ("www.google.com", headers[":authority"].as_string());
361 headers[":authority"] = "www.google.com"; 362 EXPECT_EQ("/index.html", headers[":path"].as_string());
362 EXPECT_FALSE(SpdyUtils::UrlIsValid(headers)); 363 }
363 headers[":path"] = "/index.html"; 364
364 EXPECT_TRUE(SpdyUtils::UrlIsValid(headers)); 365 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrlFails) {
366 SpdyHeaderBlock headers;
367 EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/", &headers));
368 EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/index.html", &headers));
369 EXPECT_FALSE(
370 SpdyUtils::PopulateHeaderBlockFromUrl("www.google.com/", &headers));
365 } 371 }
366 372
367 } // namespace test 373 } // namespace test
368 } // namespace net 374 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/spdy_utils.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698