| Index: components/url_formatter/url_fixer_unittest.cc
|
| diff --git a/components/url_formatter/url_fixer_unittest.cc b/components/url_formatter/url_fixer_unittest.cc
|
| index a425489494e7651b4e710e3b35d1ea586f73de80..3bb3fde8aa492602d2333543291360c3f430737c 100644
|
| --- a/components/url_formatter/url_fixer_unittest.cc
|
| +++ b/components/url_formatter/url_fixer_unittest.cc
|
| @@ -375,7 +375,7 @@ TEST(URLFixerTest, FixupFile) {
|
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| base::FilePath original;
|
| ASSERT_TRUE(MakeTempFile(
|
| - temp_dir_.path(),
|
| + temp_dir_.GetPath(),
|
| base::FilePath(FILE_PATH_LITERAL("url fixer upper existing file.txt")),
|
| &original));
|
|
|
| @@ -460,7 +460,7 @@ TEST(URLFixerTest, FixupRelativeFile) {
|
| FILE_PATH_LITERAL("url_fixer_upper_existing_file.txt"));
|
| base::ScopedTempDir temp_dir_;
|
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| - ASSERT_TRUE(MakeTempFile(temp_dir_.path(), file_part, &full_path));
|
| + ASSERT_TRUE(MakeTempFile(temp_dir_.GetPath(), file_part, &full_path));
|
| full_path = base::MakeAbsoluteFilePath(full_path);
|
| ASSERT_FALSE(full_path.empty());
|
|
|
| @@ -469,23 +469,25 @@ TEST(URLFixerTest, FixupRelativeFile) {
|
| FixupCase value = fixup_cases[i];
|
| base::FilePath input = base::FilePath::FromUTF8Unsafe(value.input);
|
| EXPECT_EQ(value.output,
|
| - url_formatter::FixupRelativeFile(temp_dir_.path(),
|
| - input).possibly_invalid_spec());
|
| + url_formatter::FixupRelativeFile(temp_dir_.GetPath(), input)
|
| + .possibly_invalid_spec());
|
| }
|
|
|
| // make sure the existing file got fixed-up to a file URL, and that there
|
| // are no backslashes
|
| EXPECT_TRUE(IsMatchingFileURL(
|
| - url_formatter::FixupRelativeFile(temp_dir_.path(),
|
| - file_part).possibly_invalid_spec(), full_path));
|
| + url_formatter::FixupRelativeFile(temp_dir_.GetPath(), file_part)
|
| + .possibly_invalid_spec(),
|
| + full_path));
|
| EXPECT_TRUE(base::DeleteFile(full_path, false));
|
|
|
| // create a filename we know doesn't exist and make sure it doesn't get
|
| // fixed up to a file URL
|
| base::FilePath nonexistent_file(
|
| FILE_PATH_LITERAL("url_fixer_upper_nonexistent_file.txt"));
|
| - std::string fixedup(url_formatter::FixupRelativeFile(
|
| - temp_dir_.path(), nonexistent_file).possibly_invalid_spec());
|
| + std::string fixedup(
|
| + url_formatter::FixupRelativeFile(temp_dir_.GetPath(), nonexistent_file)
|
| + .possibly_invalid_spec());
|
| EXPECT_NE(std::string("file:///"), fixedup.substr(0, 8));
|
| EXPECT_FALSE(IsMatchingFileURL(fixedup, nonexistent_file));
|
|
|
| @@ -495,7 +497,7 @@ TEST(URLFixerTest, FixupRelativeFile) {
|
| base::FilePath sub_dir(FILE_PATH_LITERAL("url fixer-upper dir"));
|
| base::FilePath sub_file(
|
| FILE_PATH_LITERAL("url fixer-upper existing file.txt"));
|
| - base::FilePath new_dir = temp_dir_.path().Append(sub_dir);
|
| + base::FilePath new_dir = temp_dir_.GetPath().Append(sub_dir);
|
| base::CreateDirectory(new_dir);
|
| ASSERT_TRUE(MakeTempFile(new_dir, sub_file, &full_path));
|
| full_path = base::MakeAbsoluteFilePath(full_path);
|
| @@ -504,8 +506,9 @@ TEST(URLFixerTest, FixupRelativeFile) {
|
| // test file in the subdir
|
| base::FilePath relative_file = sub_dir.Append(sub_file);
|
| EXPECT_TRUE(IsMatchingFileURL(
|
| - url_formatter::FixupRelativeFile(temp_dir_.path(),
|
| - relative_file).possibly_invalid_spec(), full_path));
|
| + url_formatter::FixupRelativeFile(temp_dir_.GetPath(), relative_file)
|
| + .possibly_invalid_spec(),
|
| + full_path));
|
|
|
| // test file in the subdir with different slashes and escaping.
|
| base::FilePath::StringType relative_file_str = sub_dir.value() +
|
| @@ -513,18 +516,20 @@ TEST(URLFixerTest, FixupRelativeFile) {
|
| base::ReplaceSubstringsAfterOffset(&relative_file_str, 0,
|
| FILE_PATH_LITERAL(" "), FILE_PATH_LITERAL("%20"));
|
| EXPECT_TRUE(IsMatchingFileURL(
|
| - url_formatter::FixupRelativeFile(temp_dir_.path(),
|
| - base::FilePath(relative_file_str)).possibly_invalid_spec(),
|
| - full_path));
|
| + url_formatter::FixupRelativeFile(temp_dir_.GetPath(),
|
| + base::FilePath(relative_file_str))
|
| + .possibly_invalid_spec(),
|
| + full_path));
|
|
|
| // test relative directories and duplicate slashes
|
| // (should resolve to the same file as above)
|
| relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") +
|
| sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value();
|
| EXPECT_TRUE(IsMatchingFileURL(
|
| - url_formatter::FixupRelativeFile(temp_dir_.path(),
|
| - base::FilePath(relative_file_str)).possibly_invalid_spec(),
|
| - full_path));
|
| + url_formatter::FixupRelativeFile(temp_dir_.GetPath(),
|
| + base::FilePath(relative_file_str))
|
| + .possibly_invalid_spec(),
|
| + full_path));
|
|
|
| // done with the subdir
|
| EXPECT_TRUE(base::DeleteFile(full_path, false));
|
|
|