Chromium Code Reviews| 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..ec370d7be582df84539b2fdebe197de54a62fd12 100644 |
| --- a/chrome/test/remoting/remote_desktop_browsertest.cc |
| +++ b/chrome/test/remoting/remote_desktop_browsertest.cc |
| @@ -826,14 +826,12 @@ void RemoteDesktopBrowserTest::SetUserNameAndPassword( |
| // 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); |
| + scoped_ptr<char[]> file_contents(new char[accounts_file_size]); |
|
Jamie
2014/10/25 00:05:14
scoped_array feels like a better fit here: https:/
anandc
2014/10/27 19:17:53
As discussed offline, scoped_ptr does the work of
|
| + ASSERT_FALSE(base::ReadFile(accounts_file_path, file_contents.get(), |
|
Lambros
2014/10/25 00:13:09
ASSERT_NE
anandc
2014/10/27 19:17:52
Done.
|
| + accounts_file_size) == -1); |
| // Get the root dictionary from the input json file contents. |
| - std::string accounts_info(buf); |
| + std::string accounts_info(file_contents.get(), accounts_file_size); |
|
Lambros
2014/10/25 00:13:09
Why not use base::ReadFileToString() ?
anandc
2014/10/27 19:17:53
Yes, we actually were using ReadFileToString earli
Lambros
2014/10/27 21:20:49
Sorry, I didn't see the comment. Maybe call base::
anandc
2014/10/27 22:18:57
Done.
|
| scoped_ptr<base::Value> root( |
| base::JSONReader::Read(accounts_info, base::JSON_ALLOW_TRAILING_COMMAS)); |