OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "chrome/browser/net/url_fixer_upper.h" | 11 #include "chrome/browser/net/url_fixer_upper.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 struct fixup_case { | 203 struct fixup_case { |
204 const std::string input; | 204 const std::string input; |
205 const std::string desired_tld; | 205 const std::string desired_tld; |
206 const std::string output; | 206 const std::string output; |
207 } fixup_cases[] = { | 207 } fixup_cases[] = { |
208 {"www.google.com", "", "http://www.google.com/"}, | 208 {"www.google.com", "", "http://www.google.com/"}, |
209 {" www.google.com ", "", "http://www.google.com/"}, | 209 {" www.google.com ", "", "http://www.google.com/"}, |
210 {" foo.com/asdf bar", "", "http://foo.com/asdf bar"}, | 210 {" foo.com/asdf bar", "", "http://foo.com/asdf bar"}, |
211 {"..www.google.com..", "", "http://www.google.com./"}, | 211 {"..www.google.com..", "", "http://www.google.com./"}, |
212 {"http://......", "", "http://....../"}, | 212 {"http://......", "", "http://....../"}, |
213 {"http://host.com:ninety-two/", "", "http://host.com/"}, | 213 {"http://host.com:ninety-two/", "", "http://host.com:ninety-two/"}, |
214 {"http://host.com:ninety-two?foo", "", "http://host.com/?foo"}, | 214 {"http://host.com:ninety-two?foo", "", "http://host.com:ninety-two/?foo"}, |
215 {"google.com:123", "", "http://google.com:123/"}, | 215 {"google.com:123", "", "http://google.com:123/"}, |
216 {"about:", "", "about:"}, | 216 {"about:", "", "about:"}, |
217 {"about:version", "", "about:version"}, | 217 {"about:version", "", "about:version"}, |
218 {"www:123", "", "http://www:123/"}, | 218 {"www:123", "", "http://www:123/"}, |
219 {" www:123", "", "http://www:123/"}, | 219 {" www:123", "", "http://www:123/"}, |
220 {"www.google.com?foo", "", "http://www.google.com/?foo"}, | 220 {"www.google.com?foo", "", "http://www.google.com/?foo"}, |
221 {"www.google.com#foo", "", "http://www.google.com/#foo"}, | 221 {"www.google.com#foo", "", "http://www.google.com/#foo"}, |
222 {"www.google.com?", "", "http://www.google.com/?"}, | 222 {"www.google.com?", "", "http://www.google.com/?"}, |
223 {"www.google.com#", "", "http://www.google.com/#"}, | 223 {"www.google.com#", "", "http://www.google.com/#"}, |
224 {"www.google.com:123?foo#bar", "", "http://www.google.com:123/?foo#bar"}, | 224 {"www.google.com:123?foo#bar", "", "http://www.google.com:123/?foo#bar"}, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // (should resolve to the same file as above) | 455 // (should resolve to the same file as above) |
456 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + | 456 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + |
457 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); | 457 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); |
458 fixedup = URLFixerUpper::FixupRelativeFile(dir, FilePath(relative_file_str)); | 458 fixedup = URLFixerUpper::FixupRelativeFile(dir, FilePath(relative_file_str)); |
459 EXPECT_TRUE(IsMatchingFileURL(fixedup, full_path)); | 459 EXPECT_TRUE(IsMatchingFileURL(fixedup, full_path)); |
460 | 460 |
461 // done with the subdir | 461 // done with the subdir |
462 EXPECT_TRUE(file_util::Delete(full_path, false)); | 462 EXPECT_TRUE(file_util::Delete(full_path, false)); |
463 EXPECT_TRUE(file_util::Delete(new_dir, true)); | 463 EXPECT_TRUE(file_util::Delete(new_dir, true)); |
464 } | 464 } |
OLD | NEW |