| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <windows.h> | 6 #include <windows.h> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 {L"www.google.com#foo", L"", L"http://www.google.com/#foo"}, | 166 {L"www.google.com#foo", L"", L"http://www.google.com/#foo"}, |
| 167 {L"www.google.com?", L"", L"http://www.google.com/?"}, | 167 {L"www.google.com?", L"", L"http://www.google.com/?"}, |
| 168 {L"www.google.com#", L"", L"http://www.google.com/#"}, | 168 {L"www.google.com#", L"", L"http://www.google.com/#"}, |
| 169 {L"www.google.com:123?foo#bar", L"", L"http://www.google.com:123/?foo#bar"}, | 169 {L"www.google.com:123?foo#bar", L"", L"http://www.google.com:123/?foo#bar"}, |
| 170 {L"user@www.google.com", L"", L"http://user@www.google.com/"}, | 170 {L"user@www.google.com", L"", L"http://user@www.google.com/"}, |
| 171 {L"\x6C34.com", L"", L"http://\x6C34.com/" }, | 171 {L"\x6C34.com", L"", L"http://\x6C34.com/" }, |
| 172 // It would be better if this next case got treated as http, but I don't see | 172 // It would be better if this next case got treated as http, but I don't see |
| 173 // a clean way to guess this isn't the new-and-exciting "user" scheme. | 173 // a clean way to guess this isn't the new-and-exciting "user" scheme. |
| 174 {L"user:passwd@www.google.com:8080/", L"", L"user:passwd@www.google.com:8080/"
}, | 174 {L"user:passwd@www.google.com:8080/", L"", L"user:passwd@www.google.com:8080/"
}, |
| 175 //{L"file:///c:/foo/bar%20baz.txt", L"", L"file:///C:/foo/bar%20baz.txt"}, | 175 //{L"file:///c:/foo/bar%20baz.txt", L"", L"file:///C:/foo/bar%20baz.txt"}, |
| 176 {L"ftp.google.com", L"", L"ftp://ftp.google.com/"}, |
| 177 {L" ftp.google.com", L"", L"ftp://ftp.google.com/"}, |
| 178 {L"FTP.GooGle.com", L"", L"ftp://FTP.GooGle.com/"}, |
| 179 {L"ftpblah.google.com", L"", L"http://ftpblah.google.com/"}, |
| 180 {L"ftp", L"", L"http://ftp/"}, |
| 181 {L"google.ftp.com", L"", L"http://google.ftp.com/"}, |
| 176 }; | 182 }; |
| 177 | 183 |
| 178 TEST(URLFixerUpperTest, FixupURL) { | 184 TEST(URLFixerUpperTest, FixupURL) { |
| 179 std::wstring output; | 185 std::wstring output; |
| 180 | 186 |
| 181 for (int i = 0; i < arraysize(fixup_cases); ++i) { | 187 for (int i = 0; i < arraysize(fixup_cases); ++i) { |
| 182 fixup_case value = fixup_cases[i]; | 188 fixup_case value = fixup_cases[i]; |
| 183 output = URLFixerUpper::FixupURL(value.input, value.desired_tld); | 189 output = URLFixerUpper::FixupURL(value.input, value.desired_tld); |
| 184 EXPECT_EQ(value.output, output); | 190 EXPECT_EQ(value.output, output); |
| 185 } | 191 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // (should resolve to the same file as above) | 325 // (should resolve to the same file as above) |
| 320 relative_file = sub_dir + L"\\../" + sub_dir + L"\\\\\\.\\" + sub_file; | 326 relative_file = sub_dir + L"\\../" + sub_dir + L"\\\\\\.\\" + sub_file; |
| 321 fixedup = URLFixerUpper::FixupRelativeFile(dir, relative_file); | 327 fixedup = URLFixerUpper::FixupRelativeFile(dir, relative_file); |
| 322 EXPECT_PRED2(IsMatchingFileURL, fixedup, full_path); | 328 EXPECT_PRED2(IsMatchingFileURL, fixedup, full_path); |
| 323 | 329 |
| 324 // done with the subdir | 330 // done with the subdir |
| 325 EXPECT_TRUE(DeleteFile(full_path.c_str())); | 331 EXPECT_TRUE(DeleteFile(full_path.c_str())); |
| 326 EXPECT_TRUE(RemoveDirectory(new_dir.c_str())); | 332 EXPECT_TRUE(RemoveDirectory(new_dir.c_str())); |
| 327 } | 333 } |
| 328 | 334 |
| OLD | NEW |