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 "chrome/browser/google_apis/test_util.h" | 5 #include "chrome/browser/google_apis/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.h" | 10 #include "base/message_loop.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 return (base::StringToInt64(parts[0], start_position) && | 195 return (base::StringToInt64(parts[0], start_position) && |
196 base::StringToInt64(parts[1], end_position)); | 196 base::StringToInt64(parts[1], end_position)); |
197 } | 197 } |
198 | 198 |
199 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, | 199 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, |
200 int64 progress, | 200 int64 progress, |
201 int64 total) { | 201 int64 total) { |
202 progress_values->push_back(ProgressInfo(progress, total)); | 202 progress_values->push_back(ProgressInfo(progress, total)); |
203 } | 203 } |
204 | 204 |
| 205 TestGetContentCallback::TestGetContentCallback() |
| 206 : ALLOW_THIS_IN_INITIALIZER_LIST(callback_( |
| 207 base::Bind(&TestGetContentCallback::OnGetContent, |
| 208 base::Unretained(this)))) { |
| 209 } |
| 210 |
| 211 TestGetContentCallback::~TestGetContentCallback() { |
| 212 } |
| 213 |
| 214 std::string TestGetContentCallback::GetConcatenatedData() const { |
| 215 std::string result; |
| 216 for (size_t i = 0; i < data_.size(); ++i) { |
| 217 result += *data_[i]; |
| 218 } |
| 219 return result; |
| 220 } |
| 221 |
| 222 void TestGetContentCallback::OnGetContent(google_apis::GDataErrorCode error, |
| 223 scoped_ptr<std::string> data) { |
| 224 data_.push_back(data.release()); |
| 225 } |
| 226 |
205 } // namespace test_util | 227 } // namespace test_util |
206 } // namespace google_apis | 228 } // namespace google_apis |
OLD | NEW |