| 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 442e643568d28e1f7cb83ef1ebf822dc32a1fd4a..4a7c86240bb3f708e3ced2779a5388b6dcf23df7 100644
|
| --- a/chrome/browser/google_apis/test_util.cc
|
| +++ b/chrome/browser/google_apis/test_util.cc
|
| @@ -14,8 +14,8 @@
|
| #include "base/threading/sequenced_worker_pool.h"
|
| #include "chrome/browser/google_apis/drive_api_parser.h"
|
| #include "chrome/browser/google_apis/gdata_wapi_parser.h"
|
| +#include "chrome/browser/google_apis/test_server/http_request.h"
|
| #include "chrome/browser/google_apis/test_server/http_response.h"
|
| -#include "chrome/browser/google_apis/test_server/http_server.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "googleurl/src/gurl.h"
|
|
|
| @@ -42,6 +42,16 @@ class TaskObserver : public MessageLoop::TaskObserver {
|
| DISALLOW_COPY_AND_ASSIGN(TaskObserver);
|
| };
|
|
|
| +bool RemovePrefix(const std::string& input,
|
| + const std::string& prefix,
|
| + std::string* output) {
|
| + if (!StartsWithASCII(input, prefix, true /* case sensitive */))
|
| + return false;
|
| +
|
| + *output = input.substr(prefix.size());
|
| + return true;
|
| +}
|
| +
|
| FilePath GetTestFilePath(const std::string& relative_path) {
|
| FilePath path;
|
| if (!PathService::Get(base::DIR_SOURCE_ROOT, &path))
|
| @@ -182,6 +192,19 @@ void DoNothingForReAuthenticateCallback(
|
| NOTREACHED();
|
| }
|
|
|
| +scoped_ptr<test_server::HttpResponse> HandleDownloadRequest(
|
| + const GURL& base_url,
|
| + test_server::HttpRequest* out_request,
|
| + const test_server::HttpRequest& request) {
|
| + *out_request = request;
|
| +
|
| + GURL absolute_url = base_url.Resolve(request.relative_url);
|
| + std::string remaining_path;
|
| + if (!RemovePrefix(absolute_url.path(), "/files/", &remaining_path))
|
| + return scoped_ptr<test_server::HttpResponse>();
|
| + return CreateHttpResponseFromFile(GetTestFilePath(remaining_path));
|
| +}
|
| +
|
| bool VerifyJsonData(const FilePath& expected_json_file_path,
|
| const base::Value* json_data) {
|
| if (!json_data) {
|
|
|