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 #ifndef CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 internal::OutputParams<T1, T2, T3, T4>(out1, out2, out3, out4)); | 280 internal::OutputParams<T1, T2, T3, T4>(out1, out2, out3, out4)); |
281 } | 281 } |
282 | 282 |
283 typedef std::pair<int64, int64> ProgressInfo; | 283 typedef std::pair<int64, int64> ProgressInfo; |
284 | 284 |
285 // Helper utility for recording the results via ProgressCallback. | 285 // Helper utility for recording the results via ProgressCallback. |
286 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, | 286 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, |
287 int64 progress, | 287 int64 progress, |
288 int64 total); | 288 int64 total); |
289 | 289 |
290 // Helpeer utility for recording the content via GetContentCallback. | 290 // Helper utility for recording the content via GetContentCallback. |
291 class TestGetContentCallback { | 291 class TestGetContentCallback { |
292 public: | 292 public: |
293 TestGetContentCallback(); | 293 TestGetContentCallback(); |
294 ~TestGetContentCallback(); | 294 ~TestGetContentCallback(); |
295 | 295 |
296 const GetContentCallback& callback() const { return callback_; } | 296 const GetContentCallback& callback() const { return callback_; } |
297 const ScopedVector<std::string>& data() const { return data_; } | 297 const ScopedVector<std::string>& data() const { return data_; } |
298 ScopedVector<std::string>* mutable_data() { return &data_; } | 298 ScopedVector<std::string>* mutable_data() { return &data_; } |
299 std::string GetConcatenatedData() const; | 299 std::string GetConcatenatedData() const; |
300 | 300 |
301 private: | 301 private: |
302 void OnGetContent(google_apis::GDataErrorCode error, | 302 void OnGetContent(google_apis::GDataErrorCode error, |
303 scoped_ptr<std::string> data); | 303 scoped_ptr<std::string> data); |
304 | 304 |
305 const GetContentCallback callback_; | 305 const GetContentCallback callback_; |
306 ScopedVector<std::string> data_; | 306 ScopedVector<std::string> data_; |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); | 308 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); |
309 }; | 309 }; |
310 | 310 |
311 } // namespace test_util | 311 } // namespace test_util |
312 } // namespace google_apis | 312 } // namespace google_apis |
313 | 313 |
314 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ | 314 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ |
OLD | NEW |