OLD | NEW |
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/memory/scoped_vector.h" |
16 #include "base/template_util.h" | 16 #include "base/template_util.h" |
17 #include "chrome/browser/google_apis/base_operations.h" | 17 #include "chrome/browser/google_apis/base_operations.h" |
18 #include "chrome/browser/google_apis/gdata_errorcode.h" | 18 #include "chrome/browser/google_apis/gdata_errorcode.h" |
19 | 19 |
20 class GURL; | 20 class GURL; |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class FilePath; | 23 class FilePath; |
24 class Value; | 24 class Value; |
25 } | 25 } |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 namespace test_server { | 28 namespace test_server { |
| 29 class BasicHttpResponse; |
| 30 class HttpResponse; |
29 struct HttpRequest; | 31 struct HttpRequest; |
30 class HttpResponse; | |
31 } | 32 } |
32 } | 33 } |
33 | 34 |
34 namespace google_apis { | 35 namespace google_apis { |
35 | 36 |
36 class AboutResource; | 37 class AboutResource; |
37 class AccountMetadata; | 38 class AccountMetadata; |
38 class AppList; | 39 class AppList; |
39 class AuthenticatedOperationInterface; | 40 class AuthenticatedOperationInterface; |
40 class ResourceEntry; | 41 class ResourceEntry; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, | 83 bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, |
83 size_t size, | 84 size_t size, |
84 base::FilePath* path, | 85 base::FilePath* path, |
85 std::string* data); | 86 std::string* data); |
86 | 87 |
87 // Loads a test JSON file as a base::Value, from a test file stored under | 88 // Loads a test JSON file as a base::Value, from a test file stored under |
88 // chrome/test/data. | 89 // chrome/test/data. |
89 scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path); | 90 scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path); |
90 | 91 |
91 // Returns a HttpResponse created from the given file path. | 92 // Returns a HttpResponse created from the given file path. |
92 scoped_ptr<net::test_server::HttpResponse> CreateHttpResponseFromFile( | 93 scoped_ptr<net::test_server::BasicHttpResponse> CreateHttpResponseFromFile( |
93 const base::FilePath& file_path); | 94 const base::FilePath& file_path); |
94 | 95 |
95 // Handles a request for downloading a file. Reads a file from the test | 96 // Handles a request for downloading a file. Reads a file from the test |
96 // directory and returns the content. Also, copies the |request| to the memory | 97 // directory and returns the content. Also, copies the |request| to the memory |
97 // pointed by |out_request|. | 98 // pointed by |out_request|. |
98 // |base_url| must be set to the server's base url. | 99 // |base_url| must be set to the server's base url. |
99 scoped_ptr<net::test_server::HttpResponse> HandleDownloadRequest( | 100 scoped_ptr<net::test_server::HttpResponse> HandleDownloadRequest( |
100 const GURL& base_url, | 101 const GURL& base_url, |
101 net::test_server::HttpRequest* out_request, | 102 net::test_server::HttpRequest* out_request, |
102 const net::test_server::HttpRequest& request); | 103 const net::test_server::HttpRequest& request); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 const GetContentCallback callback_; | 306 const GetContentCallback callback_; |
306 ScopedVector<std::string> data_; | 307 ScopedVector<std::string> data_; |
307 | 308 |
308 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); | 309 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); |
309 }; | 310 }; |
310 | 311 |
311 } // namespace test_util | 312 } // namespace test_util |
312 } // namespace google_apis | 313 } // namespace google_apis |
313 | 314 |
314 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ | 315 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ |
OLD | NEW |