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 cf34624e6956e46b062f18ad1dec5fb12124bc0b..50fe34931c4eaee27fd7acdf84d8bb73e34639ec 100644 |
--- a/chrome/test/remoting/remote_desktop_browsertest.cc |
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc |
@@ -822,10 +822,15 @@ void RemoteDesktopBrowserTest::SetUserNameAndPassword( |
const base::FilePath &accounts_file_path, const std::string& account_type) { |
// Read contents of accounts file. |
- std::string accounts_info; |
- ASSERT_TRUE(base::ReadFileToString(accounts_file_path, &accounts_info)); |
anandc
2014/10/18 02:33:45
ReadFileToString returns an error if the file-path
|
+ // To handle relative paths, we'll first get the size of the file. |
Jamie
2014/10/22 23:02:26
Getting the size of the file is not only needed fo
anandc
2014/10/23 00:00:40
Done.
|
+ int64 accounts_file_size; |
+ base::GetFileSize(accounts_file_path, &accounts_file_size); |
+ // Then read the contents of the file. |
+ char buf[accounts_file_size]; |
+ ASSERT_FALSE(base::ReadFile(accounts_file_path, buf, sizeof(buf)-1) == -1); |
Jamie
2014/10/22 23:02:26
Nit: spaces around the subtraction operator.
anandc
2014/10/23 00:00:40
Done.
|
// 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)); |