OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "google_apis/drive/test_util.h" | 5 #include "google_apis/drive/test_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return GURL(base::StringPrintf("http://127.0.0.1:%d/", port)); | 50 return GURL(base::StringPrintf("http://127.0.0.1:%d/", port)); |
51 } | 51 } |
52 | 52 |
53 void RunAndQuit(base::RunLoop* run_loop, const base::Closure& closure) { | 53 void RunAndQuit(base::RunLoop* run_loop, const base::Closure& closure) { |
54 closure.Run(); | 54 closure.Run(); |
55 run_loop->Quit(); | 55 run_loop->Quit(); |
56 } | 56 } |
57 | 57 |
58 bool WriteStringToFile(const base::FilePath& file_path, | 58 bool WriteStringToFile(const base::FilePath& file_path, |
59 const std::string& content) { | 59 const std::string& content) { |
60 int result = file_util::WriteFile( | 60 int result = base::WriteFile( |
61 file_path, content.data(), static_cast<int>(content.size())); | 61 file_path, content.data(), static_cast<int>(content.size())); |
62 return content.size() == static_cast<size_t>(result); | 62 return content.size() == static_cast<size_t>(result); |
63 } | 63 } |
64 | 64 |
65 bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, | 65 bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, |
66 size_t size, | 66 size_t size, |
67 base::FilePath* path, | 67 base::FilePath* path, |
68 std::string* data) { | 68 std::string* data) { |
69 if (!base::CreateTemporaryFileInDir(temp_dir, path)) | 69 if (!base::CreateTemporaryFileInDir(temp_dir, path)) |
70 return false; | 70 return false; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 return result; | 175 return result; |
176 } | 176 } |
177 | 177 |
178 void TestGetContentCallback::OnGetContent(google_apis::GDataErrorCode error, | 178 void TestGetContentCallback::OnGetContent(google_apis::GDataErrorCode error, |
179 scoped_ptr<std::string> data) { | 179 scoped_ptr<std::string> data) { |
180 data_.push_back(data.release()); | 180 data_.push_back(data.release()); |
181 } | 181 } |
182 | 182 |
183 } // namespace test_util | 183 } // namespace test_util |
184 } // namespace google_apis | 184 } // namespace google_apis |
OLD | NEW |