misc files R-U: Change ScopedTempDir::path() to GetPath()
path() is being deprecated, GetPath() has better checking against wrong use.
For more context, see https://codereview.chromium.org/2275553005/.
BUG=640599
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win10_chromium_x64_rel_ng
Review-Url: https://codereview.chromium.org/2317123003
Cr-Original-Commit-Position: refs/heads/master@{#421483}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a98198273f744d4e045e759734bbaa69962fa94d
diff --git a/tools/gn/exec_process_unittest.cc b/tools/gn/exec_process_unittest.cc
index 70a208c..51ce7b7 100644
--- a/tools/gn/exec_process_unittest.cc
+++ b/tools/gn/exec_process_unittest.cc
@@ -26,6 +26,7 @@
std::string* std_err,
int* exit_code) {
base::ScopedTempDir temp_dir;
+ CHECK(temp_dir.CreateUniqueTempDir());
base::CommandLine::StringVector args;
#if defined(OS_WIN)
args.push_back(L"python");
@@ -36,8 +37,8 @@
args.push_back("-c");
args.push_back(command);
#endif
- return ExecProcess(
- base::CommandLine(args), temp_dir.path(), std_out, std_err, exit_code);
+ return ExecProcess(base::CommandLine(args), temp_dir.GetPath(), std_out,
+ std_err, exit_code);
}
} // namespace
diff --git a/tools/gn/filesystem_utils_unittest.cc b/tools/gn/filesystem_utils_unittest.cc
index 240ed61..f5724c4 100644
--- a/tools/gn/filesystem_utils_unittest.cc
+++ b/tools/gn/filesystem_utils_unittest.cc
@@ -581,7 +581,7 @@
std::string data = "foo";
- base::FilePath file_path = temp_dir.path().AppendASCII("foo.txt");
+ base::FilePath file_path = temp_dir.GetPath().AppendASCII("foo.txt");
base::WriteFile(file_path, data.c_str(), static_cast<int>(data.size()));
EXPECT_TRUE(ContentsEqual(file_path, data));
@@ -602,7 +602,7 @@
// Write if file doesn't exist. Create also directory.
base::FilePath file_path =
- temp_dir.path().AppendASCII("bar").AppendASCII("foo.txt");
+ temp_dir.GetPath().AppendASCII("bar").AppendASCII("foo.txt");
EXPECT_TRUE(WriteFileIfChanged(file_path, data, nullptr));
base::File::Info file_info;
diff --git a/tools/gn/function_write_file_unittest.cc b/tools/gn/function_write_file_unittest.cc
index 50a0f43..8f2b42a 100644
--- a/tools/gn/function_write_file_unittest.cc
+++ b/tools/gn/function_write_file_unittest.cc
@@ -40,7 +40,7 @@
// Make a real directory for writing the files.
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- setup.build_settings()->SetRootPath(temp_dir.path());
+ setup.build_settings()->SetRootPath(temp_dir.GetPath());
setup.build_settings()->SetBuildDir(SourceDir("//out/"));
Value some_string(nullptr, "some string contents");
@@ -52,8 +52,9 @@
// Should be able to write to a new dir inside the out dir.
EXPECT_TRUE(CallWriteFile(setup.scope(), "//out/foo.txt", some_string));
- base::FilePath foo_name = temp_dir.path().Append(FILE_PATH_LITERAL("out"))
- .Append(FILE_PATH_LITERAL("foo.txt"));
+ base::FilePath foo_name = temp_dir.GetPath()
+ .Append(FILE_PATH_LITERAL("out"))
+ .Append(FILE_PATH_LITERAL("foo.txt"));
std::string result_contents;
EXPECT_TRUE(base::ReadFileToString(foo_name, &result_contents));
EXPECT_EQ(some_string.string_value(), result_contents);