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

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

Issue 7572046: Be a little more careful whether something is an URL or a file path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // test relative directories and duplicate slashes 509 // test relative directories and duplicate slashes
510 // (should resolve to the same file as above) 510 // (should resolve to the same file as above)
511 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + 511 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") +
512 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); 512 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value();
513 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, 513 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir,
514 FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); 514 FilePath(relative_file_str)).possibly_invalid_spec(), full_path));
515 515
516 // done with the subdir 516 // done with the subdir
517 EXPECT_TRUE(file_util::Delete(full_path, false)); 517 EXPECT_TRUE(file_util::Delete(full_path, false));
518 EXPECT_TRUE(file_util::Delete(new_dir, true)); 518 EXPECT_TRUE(file_util::Delete(new_dir, true));
519
520 // Test that an obvious HTTP URL isn't accidentally treated as an absolute
521 // file path (on account of system-specific craziness).
522 FilePath empty_path;
523 FilePath http_url_path(FILE_PATH_LITERAL("http://../"));
524 EXPECT_TRUE(URLFixerUpper::FixupRelativeFile(
525 empty_path, http_url_path).SchemeIs("http"));
519 } 526 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698