Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: chrome/browser/google_apis/test_util.h

Issue 14362022: Extract testing utility TestGetContentCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h"
15 #include "base/template_util.h" 16 #include "base/template_util.h"
17 #include "chrome/browser/google_apis/base_operations.h"
16 #include "chrome/browser/google_apis/gdata_errorcode.h" 18 #include "chrome/browser/google_apis/gdata_errorcode.h"
17 19
18 class GURL; 20 class GURL;
19 21
20 namespace base { 22 namespace base {
21 class FilePath; 23 class FilePath;
22 class Value; 24 class Value;
23 } 25 }
24 26
25 namespace google_apis { 27 namespace google_apis {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 internal::OutputParams<T1, T2, T3, T4>(out1, out2, out3, out4)); 269 internal::OutputParams<T1, T2, T3, T4>(out1, out2, out3, out4));
268 } 270 }
269 271
270 typedef std::pair<int64, int64> ProgressInfo; 272 typedef std::pair<int64, int64> ProgressInfo;
271 273
272 // Helper utility for recording the results via ProgressCallback. 274 // Helper utility for recording the results via ProgressCallback.
273 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, 275 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values,
274 int64 progress, 276 int64 progress,
275 int64 total); 277 int64 total);
276 278
279 // Helpeer utility for recording the content via GetContentCallback.
280 class TestGetContentCallback {
281 public:
282 TestGetContentCallback();
283 ~TestGetContentCallback();
284
285 const GetContentCallback& callback() const { return callback_; }
286 const ScopedVector<std::string>& data() const { return data_; }
287 ScopedVector<std::string>* mutable_data() { return &data_; }
288 std::string GetConcatenatedData() const;
289
290 private:
291 void OnGetContent(google_apis::GDataErrorCode error,
292 scoped_ptr<std::string> data);
293
294 const GetContentCallback callback_;
295 ScopedVector<std::string> data_;
296
297 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback);
298 };
299
277 } // namespace test_util 300 } // namespace test_util
278 } // namespace google_apis 301 } // namespace google_apis
279 302
280 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ 303 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/fake_drive_service_unittest.cc ('k') | chrome/browser/google_apis/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698