summaryrefslogtreecommitdiffstats
path: root/chrome/browser/google_apis/test_util.cc
diff options
context:
space:
mode:
authorhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 18:35:50 +0000
committerhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 18:35:50 +0000
commit07c19eb03aaf34ce9c1718025cceb5375dcb0590 (patch)
tree05793777f5ef32a378693ef2d0628b5d22b7cd73 /chrome/browser/google_apis/test_util.cc
parent3f6367db4f394ee347fb74b0d038f1a66f4b8d14 (diff)
downloadchromium_src-07c19eb03aaf34ce9c1718025cceb5375dcb0590.zip
chromium_src-07c19eb03aaf34ce9c1718025cceb5375dcb0590.tar.gz
chromium_src-07c19eb03aaf34ce9c1718025cceb5375dcb0590.tar.bz2
Extract testing utility TestGetContentCallback.
The callback will be reused in the following CL's testing code. BUG=127129 TEST=Ran unit_tests Review URL: https://chromiumcodereview.appspot.com/14362022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google_apis/test_util.cc')
-rw-r--r--chrome/browser/google_apis/test_util.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc
index 27d3957..9dbbf1d 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