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

Unified Diff: chrome/test/remoting/remote_desktop_browsertest.cc

Issue 680643003: Read contents of test file after getting its absolute path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create absolute path, for use in call to ReadFileToString. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/remoting/remote_desktop_browsertest.cc
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc
index b1d5717fcda55ac6b14875e7534da2038b612598..82bf6e72ade37b0c6d0c74ce8a67760441b1272e 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -821,19 +821,12 @@ void RemoteDesktopBrowserTest::DismissHostVersionWarningIfVisible() {
void RemoteDesktopBrowserTest::SetUserNameAndPassword(
const base::FilePath &accounts_file_path, const std::string& account_type) {
- // ReadFileToString returns an error if the file-path is relative.
- // Tests that run on the swarming slaves use relative paths, so we have to use
- // ReadFile instead.
- int64 accounts_file_size;
- base::GetFileSize(accounts_file_path, &accounts_file_size);
- // There is a compile error on Windows if you use a non-constant array size.
- // For the test-accounts file, we'll assume a maximum file size of 10K.
- char buf[10240];
- ASSERT_FALSE(base::ReadFile(accounts_file_path, buf, accounts_file_size - 1)
- == -1);
+ // Read contents of accounts file, using its absolute path.
+ base::FilePath absolute_path = base::MakeAbsoluteFilePath(accounts_file_path);
+ std::string accounts_info;
+ ASSERT_TRUE(base::ReadFileToString(absolute_path, &accounts_info));
// Get the root dictionary from the input json file contents.
- std::string accounts_info(buf);
scoped_ptr<base::Value> root(
base::JSONReader::Read(accounts_info, base::JSON_ALLOW_TRAILING_COMMAS));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698