| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "url/url_parse.h" | 5 #include "url/url_parse.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "url/url_parse.h" | 9 #include "url/url_parse.h" |
| 10 | 10 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 352 |
| 353 TEST(URLParser, PathURL) { | 353 TEST(URLParser, PathURL) { |
| 354 // Declared outside for loop to try to catch cases in init() where we forget | 354 // Declared outside for loop to try to catch cases in init() where we forget |
| 355 // to reset something that is reset by the construtor. | 355 // to reset something that is reset by the construtor. |
| 356 url_parse::Parsed parsed; | 356 url_parse::Parsed parsed; |
| 357 for (size_t i = 0; i < arraysize(path_cases); i++) { | 357 for (size_t i = 0; i < arraysize(path_cases); i++) { |
| 358 const char* url = path_cases[i].input; | 358 const char* url = path_cases[i].input; |
| 359 url_parse::ParsePathURL(url, static_cast<int>(strlen(url)), &parsed); | 359 url_parse::ParsePathURL(url, static_cast<int>(strlen(url)), &parsed); |
| 360 | 360 |
| 361 EXPECT_TRUE(ComponentMatches(url, path_cases[i].scheme, parsed.scheme)); | 361 EXPECT_TRUE(ComponentMatches(url, path_cases[i].scheme, parsed.scheme)); |
| 362 EXPECT_TRUE(ComponentMatches(url, path_cases[i].path, parsed.path)); | 362 EXPECT_TRUE(ComponentMatches(url, path_cases[i].path, parsed.Content())); |
| 363 | 363 |
| 364 // The remaining components are never used for path urls. | 364 // The remaining components are never used for path urls. |
| 365 ExpectInvalidComponent(parsed.username); | 365 ExpectInvalidComponent(parsed.username); |
| 366 ExpectInvalidComponent(parsed.password); | 366 ExpectInvalidComponent(parsed.password); |
| 367 ExpectInvalidComponent(parsed.host); | 367 ExpectInvalidComponent(parsed.host); |
| 368 ExpectInvalidComponent(parsed.port); | 368 ExpectInvalidComponent(parsed.port); |
| 369 ExpectInvalidComponent(parsed.query); | |
| 370 ExpectInvalidComponent(parsed.ref); | |
| 371 } | 369 } |
| 372 } | 370 } |
| 373 | 371 |
| 374 #ifdef WIN32 | 372 #ifdef WIN32 |
| 375 | 373 |
| 376 // WindowsFile ---------------------------------------------------------------- | 374 // WindowsFile ---------------------------------------------------------------- |
| 377 | 375 |
| 378 // Various incarnations of file URLs. These are for Windows only. | 376 // Various incarnations of file URLs. These are for Windows only. |
| 379 static URLParseCase file_cases[] = { | 377 static URLParseCase file_cases[] = { |
| 380 {"file:server", "file", NULL, NULL, "server", -1, NULL, NU
LL, NULL}, | 378 {"file:server", "file", NULL, NULL, "server", -1, NULL, NU
LL, NULL}, |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 // The remaining components are never used for filesystem urls. | 615 // The remaining components are never used for filesystem urls. |
| 618 ExpectInvalidComponent(parsed.username); | 616 ExpectInvalidComponent(parsed.username); |
| 619 ExpectInvalidComponent(parsed.password); | 617 ExpectInvalidComponent(parsed.password); |
| 620 ExpectInvalidComponent(parsed.host); | 618 ExpectInvalidComponent(parsed.host); |
| 621 ExpectInvalidComponent(parsed.port); | 619 ExpectInvalidComponent(parsed.port); |
| 622 } | 620 } |
| 623 } | 621 } |
| 624 | 622 |
| 625 } // namespace | 623 } // namespace |
| 626 } // namespace url_parse | 624 } // namespace url_parse |
| OLD | NEW |