OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
5 #include "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 "http://google.com/sup?yo", | 3019 "http://google.com/sup?yo", |
3020 }, | 3020 }, |
3021 { // Try an HTTPS URL -- strip both the reference and the username/password. | 3021 { // Try an HTTPS URL -- strip both the reference and the username/password. |
3022 "https://user:pass@google.com:80/sup?yo#X#X", | 3022 "https://user:pass@google.com:80/sup?yo#X#X", |
3023 "https://google.com:80/sup?yo", | 3023 "https://google.com:80/sup?yo", |
3024 }, | 3024 }, |
3025 { // Try an FTP URL -- strip both the reference and the username/password. | 3025 { // Try an FTP URL -- strip both the reference and the username/password. |
3026 "ftp://user:pass@google.com:80/sup?yo#X#X", | 3026 "ftp://user:pass@google.com:80/sup?yo#X#X", |
3027 "ftp://google.com:80/sup?yo", | 3027 "ftp://google.com:80/sup?yo", |
3028 }, | 3028 }, |
3029 { // Try an nonstandard URL | 3029 { // Try a nonstandard URL |
3030 "foobar://user:pass@google.com:80/sup?yo#X#X", | 3030 "foobar://user:pass@google.com:80/sup?yo#X#X", |
3031 "foobar://user:pass@google.com:80/sup?yo#X#X", | 3031 "foobar://user:pass@google.com:80/sup?yo", |
3032 }, | 3032 }, |
3033 }; | 3033 }; |
3034 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 3034 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
3035 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 3035 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |
3036 tests[i].input_url)); | 3036 tests[i].input_url)); |
3037 GURL input_url(GURL(tests[i].input_url)); | 3037 GURL input_url(GURL(tests[i].input_url)); |
3038 GURL expected_url(GURL(tests[i].expected_simplified_url)); | 3038 GURL expected_url(GURL(tests[i].expected_simplified_url)); |
3039 EXPECT_EQ(expected_url, SimplifyUrlForRequest(input_url)); | 3039 EXPECT_EQ(expected_url, SimplifyUrlForRequest(input_url)); |
3040 } | 3040 } |
3041 } | 3041 } |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3469 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 3469 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
3470 const NonUniqueNameTestData& test_data = GetParam(); | 3470 const NonUniqueNameTestData& test_data = GetParam(); |
3471 | 3471 |
3472 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 3472 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
3473 } | 3473 } |
3474 | 3474 |
3475 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 3475 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
3476 testing::ValuesIn(kNonUniqueNameTestData)); | 3476 testing::ValuesIn(kNonUniqueNameTestData)); |
3477 | 3477 |
3478 } // namespace net | 3478 } // namespace net |
OLD | NEW |