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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 const char* input; | 1684 const char* input; |
1685 const char* expected; | 1685 const char* expected; |
1686 bool expected_success; | 1686 bool expected_success; |
1687 } cases[] = { | 1687 } cases[] = { |
1688 {"Filesystem:htTp://www.Foo.com:80/tempoRary", "filesystem:http://www.foo.co
m/tempoRary/", true}, | 1688 {"Filesystem:htTp://www.Foo.com:80/tempoRary", "filesystem:http://www.foo.co
m/tempoRary/", true}, |
1689 {"filesystem:httpS://www.foo.com/temporary/", "filesystem:https://www.foo.co
m/temporary/", true}, | 1689 {"filesystem:httpS://www.foo.com/temporary/", "filesystem:https://www.foo.co
m/temporary/", true}, |
1690 {"filesystem:http://www.foo.com//", "filesystem:http://www.foo.com//", false
}, | 1690 {"filesystem:http://www.foo.com//", "filesystem:http://www.foo.com//", false
}, |
1691 {"filesystem:http://www.foo.com/persistent/bob?query#ref", "filesystem:http:
//www.foo.com/persistent/bob?query#ref", true}, | 1691 {"filesystem:http://www.foo.com/persistent/bob?query#ref", "filesystem:http:
//www.foo.com/persistent/bob?query#ref", true}, |
1692 {"filesystem:fIle://\\temporary/", "filesystem:file:///temporary/", true}, | 1692 {"filesystem:fIle://\\temporary/", "filesystem:file:///temporary/", true}, |
1693 {"filesystem:fiLe:///temporary", "filesystem:file:///temporary/", true}, | 1693 {"filesystem:fiLe:///temporary", "filesystem:file:///temporary/", true}, |
1694 {"filesystem:file:///////temporary", "filesystem:file:////", false}, | |
1695 {"filesystem:File:///temporary/Bob?qUery#reF", "filesystem:file:///temporary
/Bob?qUery#reF", true}, | 1694 {"filesystem:File:///temporary/Bob?qUery#reF", "filesystem:file:///temporary
/Bob?qUery#reF", true}, |
1696 }; | 1695 }; |
1697 | 1696 |
1698 for (size_t i = 0; i < ARRAYSIZE(cases); i++) { | 1697 for (size_t i = 0; i < ARRAYSIZE(cases); i++) { |
1699 int url_len = static_cast<int>(strlen(cases[i].input)); | 1698 int url_len = static_cast<int>(strlen(cases[i].input)); |
1700 url_parse::Parsed parsed; | 1699 url_parse::Parsed parsed; |
1701 url_parse::ParseFileSystemURL(cases[i].input, url_len, &parsed); | 1700 url_parse::ParseFileSystemURL(cases[i].input, url_len, &parsed); |
1702 | 1701 |
1703 url_parse::Parsed out_parsed; | 1702 url_parse::Parsed out_parsed; |
1704 std::string out_str; | 1703 std::string out_str; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 url_canon::StdStringCanonOutput repl_output(&repl_str); | 2125 url_canon::StdStringCanonOutput repl_output(&repl_str); |
2127 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; | 2126 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; |
2128 repl_output.Complete(); | 2127 repl_output.Complete(); |
2129 | 2128 |
2130 // Generate the expected string and check. | 2129 // Generate the expected string and check. |
2131 std::string expected("file:///foo?"); | 2130 std::string expected("file:///foo?"); |
2132 for (size_t i = 0; i < new_query.length(); i++) | 2131 for (size_t i = 0; i < new_query.length(); i++) |
2133 expected.push_back('a'); | 2132 expected.push_back('a'); |
2134 EXPECT_TRUE(expected == repl_str); | 2133 EXPECT_TRUE(expected == repl_str); |
2135 } | 2134 } |
OLD | NEW |