OLD | NEW |
1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 &out_parsed); | 1704 &out_parsed); |
1705 output.Complete(); | 1705 output.Complete(); |
1706 | 1706 |
1707 EXPECT_EQ(cases[i].expected_success, success); | 1707 EXPECT_EQ(cases[i].expected_success, success); |
1708 EXPECT_EQ(cases[i].expected, out_str); | 1708 EXPECT_EQ(cases[i].expected, out_str); |
1709 | 1709 |
1710 // Make sure the spec was properly identified, the filesystem canonicalizer | 1710 // Make sure the spec was properly identified, the filesystem canonicalizer |
1711 // has different code for writing the spec. | 1711 // has different code for writing the spec. |
1712 EXPECT_EQ(0, out_parsed.scheme.begin); | 1712 EXPECT_EQ(0, out_parsed.scheme.begin); |
1713 EXPECT_EQ(10, out_parsed.scheme.len); | 1713 EXPECT_EQ(10, out_parsed.scheme.len); |
| 1714 if (success) |
| 1715 EXPECT_GT(out_parsed.path.len, 0); |
1714 } | 1716 } |
1715 } | 1717 } |
1716 | 1718 |
1717 TEST(URLCanonTest, CanonicalizePathURL) { | 1719 TEST(URLCanonTest, CanonicalizePathURL) { |
1718 // Path URLs should get canonicalized schemes but nothing else. | 1720 // Path URLs should get canonicalized schemes but nothing else. |
1719 struct PathCase { | 1721 struct PathCase { |
1720 const char* input; | 1722 const char* input; |
1721 const char* expected; | 1723 const char* expected; |
1722 } path_cases[] = { | 1724 } path_cases[] = { |
1723 {"javascript:", "javascript:"}, | 1725 {"javascript:", "javascript:"}, |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 url_canon::StdStringCanonOutput repl_output(&repl_str); | 2121 url_canon::StdStringCanonOutput repl_output(&repl_str); |
2120 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; | 2122 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; |
2121 repl_output.Complete(); | 2123 repl_output.Complete(); |
2122 | 2124 |
2123 // Generate the expected string and check. | 2125 // Generate the expected string and check. |
2124 std::string expected("file:///foo?"); | 2126 std::string expected("file:///foo?"); |
2125 for (size_t i = 0; i < new_query.length(); i++) | 2127 for (size_t i = 0; i < new_query.length(); i++) |
2126 expected.push_back('a'); | 2128 expected.push_back('a'); |
2127 EXPECT_TRUE(expected == repl_str); | 2129 EXPECT_TRUE(expected == repl_str); |
2128 } | 2130 } |
OLD | NEW |