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

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

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/common/mac/mock_launchd.cc ('k') | chrome/installer/setup/install_unittest.cc » ('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) 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/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 EXPECT_NE(std::string("file:///"), fixedup.substr(0, 8)); 494 EXPECT_NE(std::string("file:///"), fixedup.substr(0, 8));
495 EXPECT_FALSE(IsMatchingFileURL(fixedup, nonexistent_file)); 495 EXPECT_FALSE(IsMatchingFileURL(fixedup, nonexistent_file));
496 496
497 // make a subdir to make sure relative paths with directories work, also 497 // make a subdir to make sure relative paths with directories work, also
498 // test spaces: 498 // test spaces:
499 // "app_dir\url fixer-upper dir\url fixer-upper existing file.txt" 499 // "app_dir\url fixer-upper dir\url fixer-upper existing file.txt"
500 base::FilePath sub_dir(FILE_PATH_LITERAL("url fixer-upper dir")); 500 base::FilePath sub_dir(FILE_PATH_LITERAL("url fixer-upper dir"));
501 base::FilePath sub_file( 501 base::FilePath sub_file(
502 FILE_PATH_LITERAL("url fixer-upper existing file.txt")); 502 FILE_PATH_LITERAL("url fixer-upper existing file.txt"));
503 base::FilePath new_dir = dir.Append(sub_dir); 503 base::FilePath new_dir = dir.Append(sub_dir);
504 file_util::CreateDirectory(new_dir); 504 base::CreateDirectory(new_dir);
505 ASSERT_TRUE(MakeTempFile(new_dir, sub_file, &full_path)); 505 ASSERT_TRUE(MakeTempFile(new_dir, sub_file, &full_path));
506 full_path = base::MakeAbsoluteFilePath(full_path); 506 full_path = base::MakeAbsoluteFilePath(full_path);
507 ASSERT_FALSE(full_path.empty()); 507 ASSERT_FALSE(full_path.empty());
508 508
509 // test file in the subdir 509 // test file in the subdir
510 base::FilePath relative_file = sub_dir.Append(sub_file); 510 base::FilePath relative_file = sub_dir.Append(sub_file);
511 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, 511 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir,
512 relative_file).possibly_invalid_spec(), full_path)); 512 relative_file).possibly_invalid_spec(), full_path));
513 513
514 // test file in the subdir with different slashes and escaping. 514 // test file in the subdir with different slashes and escaping.
(...skipping 15 matching lines...) Expand all
530 EXPECT_TRUE(base::DeleteFile(full_path, false)); 530 EXPECT_TRUE(base::DeleteFile(full_path, false));
531 EXPECT_TRUE(base::DeleteFile(new_dir, true)); 531 EXPECT_TRUE(base::DeleteFile(new_dir, true));
532 532
533 // Test that an obvious HTTP URL isn't accidentally treated as an absolute 533 // Test that an obvious HTTP URL isn't accidentally treated as an absolute
534 // file path (on account of system-specific craziness). 534 // file path (on account of system-specific craziness).
535 base::FilePath empty_path; 535 base::FilePath empty_path;
536 base::FilePath http_url_path(FILE_PATH_LITERAL("http://../")); 536 base::FilePath http_url_path(FILE_PATH_LITERAL("http://../"));
537 EXPECT_TRUE(URLFixerUpper::FixupRelativeFile( 537 EXPECT_TRUE(URLFixerUpper::FixupRelativeFile(
538 empty_path, http_url_path).SchemeIs("http")); 538 empty_path, http_url_path).SchemeIs("http"));
539 } 539 }
OLDNEW
« no previous file with comments | « chrome/common/mac/mock_launchd.cc ('k') | chrome/installer/setup/install_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698