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

Unified Diff: chrome/browser/google_apis/test_util.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/google_apis/test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/test_util.cc
diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc
index 27d395767bd5e6f8b2131308b5c218271e2861f5..9dbbf1db66c820f7c147de2a9856fc7baddb52a8 100644
--- a/chrome/browser/google_apis/test_util.cc
+++ b/chrome/browser/google_apis/test_util.cc
@@ -202,5 +202,27 @@ void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values,
progress_values->push_back(ProgressInfo(progress, total));
}
+TestGetContentCallback::TestGetContentCallback()
+ : ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
+ base::Bind(&TestGetContentCallback::OnGetContent,
+ base::Unretained(this)))) {
+}
+
+TestGetContentCallback::~TestGetContentCallback() {
+}
+
+std::string TestGetContentCallback::GetConcatenatedData() const {
+ std::string result;
+ for (size_t i = 0; i < data_.size(); ++i) {
+ result += *data_[i];
+ }
+ return result;
+}
+
+void TestGetContentCallback::OnGetContent(google_apis::GDataErrorCode error,
+ scoped_ptr<std::string> data) {
+ data_.push_back(data.release());
+}
+
} // namespace test_util
} // namespace google_apis
« no previous file with comments | « chrome/browser/google_apis/test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698