Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: chrome/browser/net/url_fixer_upper_unittest.cc

Issue 579004: Pull latest googleurl to get various fixes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 fixup_case file_cases[] = { 335 fixup_case file_cases[] = {
336 // File URLs go through GURL, which tries to escape intelligently. 336 // File URLs go through GURL, which tries to escape intelligently.
337 {"c:\\This%20is a non-existent file.txt", "", 337 {"c:\\This%20is a non-existent file.txt", "",
338 "file:///C:/This%2520is%20a%20non-existent%20file.txt"}, 338 "file:///C:/This%2520is%20a%20non-existent%20file.txt"},
339 339
340 // \\foo\bar.txt -> file://foo/bar.txt 340 // \\foo\bar.txt -> file://foo/bar.txt
341 // UNC paths, this file won't exist, but since there are no escapes, it 341 // UNC paths, this file won't exist, but since there are no escapes, it
342 // should be returned just converted to a file: URL. 342 // should be returned just converted to a file: URL.
343 {"\\\\SomeNonexistentHost\\foo\\bar.txt", "", 343 {"\\\\SomeNonexistentHost\\foo\\bar.txt", "",
344 "file://somenonexistenthost/foo/bar.txt"}, 344 "file://somenonexistenthost/foo/bar.txt"},
345 // We do this strictly, like IE8, which only accepts this form using
346 // backslashes and not forward ones. Its a bit weird that the host/path is
347 // "more canonicalized" in the UNC case above, and in the http case it
348 // isn't lowercased, etc. That level of canonicalization will happen when
349 // it's actually turned into a GURL, so we don't care about it here. Turning
350 // "//foo" into "http" matches Firefox and IE, silly though it may seem
351 // (it falls out of adding "http" as the default protocol if you haven't
352 // entered one).
345 {"//SomeNonexistentHost\\foo/bar.txt", "", 353 {"//SomeNonexistentHost\\foo/bar.txt", "",
346 "file://somenonexistenthost/foo/bar.txt"}, 354 "http://SomeNonexistentHost\\foo/bar.txt"},
347 {"file:///C:/foo/bar", "", "file:///C:/foo/bar"}, 355 {"file:///C:/foo/bar", "", "file:///C:/foo/bar"},
348 356
349 // These are fixups we don't do, but could consider: 357 // These are fixups we don't do, but could consider:
350 // 358 //
351 // {"file://C:/foo/bar", "", "file:///C:/foo/bar"}, 359 // {"file://C:/foo/bar", "", "file:///C:/foo/bar"},
352 // {"file:c:", "", "file:///c:/"}, 360 // {"file:c:", "", "file:///c:/"},
353 // {"file:c:WINDOWS", "", "file:///c:/WINDOWS"}, 361 // {"file:c:WINDOWS", "", "file:///c:/WINDOWS"},
354 // {"file:c|Program Files", "", "file:///c:/Program Files"}, 362 // {"file:c|Program Files", "", "file:///c:/Program Files"},
355 // {"file:///foo:/bar", "", "file://foo/bar"}, 363 // {"file:///foo:/bar", "", "file://foo/bar"},
356 // {"file:/file", "", "file://file/"}, 364 // {"file:/file", "", "file://file/"},
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // (should resolve to the same file as above) 465 // (should resolve to the same file as above)
458 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + 466 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") +
459 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); 467 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value();
460 fixedup = URLFixerUpper::FixupRelativeFile(dir, FilePath(relative_file_str)); 468 fixedup = URLFixerUpper::FixupRelativeFile(dir, FilePath(relative_file_str));
461 EXPECT_TRUE(IsMatchingFileURL(fixedup, full_path)); 469 EXPECT_TRUE(IsMatchingFileURL(fixedup, full_path));
462 470
463 // done with the subdir 471 // done with the subdir
464 EXPECT_TRUE(file_util::Delete(full_path, false)); 472 EXPECT_TRUE(file_util::Delete(full_path, false));
465 EXPECT_TRUE(file_util::Delete(new_dir, true)); 473 EXPECT_TRUE(file_util::Delete(new_dir, true));
466 } 474 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698