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 009c0269095df51a72ef5171676d93818a5a94f1..05eb682a47bb5acb2539315076bc52dd74e6ffc5 100644 |
--- a/chrome/browser/google_apis/test_util.cc |
+++ b/chrome/browser/google_apis/test_util.cc |
@@ -6,6 +6,7 @@ |
#include "base/file_util.h" |
#include "base/json/json_file_value_serializer.h" |
+#include "base/json/json_reader.h" |
#include "base/message_loop.h" |
#include "base/path_service.h" |
#include "base/string_util.h" |
@@ -90,6 +91,15 @@ void CopyResultsFromGetDataCallback(GDataErrorCode* error_out, |
*error_out = error_in; |
} |
+void CopyResultsFromGetDataCallbackAndQuit(GDataErrorCode* error_out, |
+ scoped_ptr<base::Value>* value_out, |
+ GDataErrorCode error_in, |
+ scoped_ptr<base::Value> value_in) { |
+ *error_out = error_in; |
+ *value_out = value_in.Pass(); |
+ MessageLoop::current()->Quit(); |
+} |
+ |
void CopyResultsFromGetResourceEntryCallback( |
GDataErrorCode* error_out, |
scoped_ptr<ResourceEntry>* resource_entry_out, |
@@ -139,5 +149,35 @@ scoped_ptr<test_server::HttpResponse> CreateHttpResponseFromFile( |
return http_response.Pass(); |
} |
+void DoNothingForReAuthenticateCallback( |
+ AuthenticatedOperationInterface* /* operation */) { |
+ NOTREACHED(); |
+} |
+ |
+bool VerifyJsonData(const FilePath& expected_json_file_path, |
+ const base::Value* json_data) { |
+ if (!json_data) { |
+ LOG(ERROR) << "json_data is NULL"; |
+ return false; |
+ } |
+ |
+ std::string expected_content; |
+ if (!file_util::ReadFileToString( |
+ expected_json_file_path, &expected_content)) { |
+ LOG(ERROR) << "Failed to read file: " << expected_json_file_path.value(); |
+ return false; |
+ } |
+ |
+ scoped_ptr<base::Value> expected_json_data( |
+ base::JSONReader::Read(expected_content)); |
+ if (!base::Value::Equals(expected_json_data.get(), json_data)) { |
+ LOG(ERROR) |
+ << "The value of json_data is different from the file's content."; |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
} // namespace test_util |
} // namespace google_apis |