OLD | NEW |
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrl) { | 356 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrl) { |
357 string url = "https://www.google.com/index.html"; | 357 string url = "https://www.google.com/index.html"; |
358 SpdyHeaderBlock headers; | 358 SpdyHeaderBlock headers; |
359 EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers)); | 359 EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers)); |
360 EXPECT_EQ("https", headers[":scheme"].as_string()); | 360 EXPECT_EQ("https", headers[":scheme"].as_string()); |
361 EXPECT_EQ("www.google.com", headers[":authority"].as_string()); | 361 EXPECT_EQ("www.google.com", headers[":authority"].as_string()); |
362 EXPECT_EQ("/index.html", headers[":path"].as_string()); | 362 EXPECT_EQ("/index.html", headers[":path"].as_string()); |
363 } | 363 } |
364 | 364 |
| 365 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrlWithNoPath) { |
| 366 string url = "https://www.google.com"; |
| 367 SpdyHeaderBlock headers; |
| 368 EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers)); |
| 369 EXPECT_EQ("https", headers[":scheme"].as_string()); |
| 370 EXPECT_EQ("www.google.com", headers[":authority"].as_string()); |
| 371 EXPECT_EQ("/", headers[":path"].as_string()); |
| 372 } |
| 373 |
365 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrlFails) { | 374 TEST(SpdyUtilsTest, PopulateHeaderBlockFromUrlFails) { |
366 SpdyHeaderBlock headers; | 375 SpdyHeaderBlock headers; |
367 EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/", &headers)); | 376 EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/", &headers)); |
368 EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/index.html", &headers)); | 377 EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/index.html", &headers)); |
369 EXPECT_FALSE( | 378 EXPECT_FALSE( |
370 SpdyUtils::PopulateHeaderBlockFromUrl("www.google.com/", &headers)); | 379 SpdyUtils::PopulateHeaderBlockFromUrl("www.google.com/", &headers)); |
371 } | 380 } |
372 | 381 |
373 } // namespace test | 382 } // namespace test |
374 } // namespace net | 383 } // namespace net |
OLD | NEW |