| 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> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 std::string* data); | 85 std::string* data); |
| 86 | 86 |
| 87 // Loads a test JSON file as a base::Value, from a test file stored under | 87 // Loads a test JSON file as a base::Value, from a test file stored under |
| 88 // chrome/test/data. | 88 // chrome/test/data. |
| 89 scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path); | 89 scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path); |
| 90 | 90 |
| 91 // Returns a HttpResponse created from the given file path. | 91 // Returns a HttpResponse created from the given file path. |
| 92 scoped_ptr<net::test_server::HttpResponse> CreateHttpResponseFromFile( | 92 scoped_ptr<net::test_server::HttpResponse> CreateHttpResponseFromFile( |
| 93 const base::FilePath& file_path); | 93 const base::FilePath& file_path); |
| 94 | 94 |
| 95 // Does nothing for ReAuthenticateCallback(). This function should be used | |
| 96 // if it is not expected to reach this method as there won't be any | |
| 97 // authentication failures in the test. | |
| 98 void DoNothingForReAuthenticateCallback( | |
| 99 AuthenticatedOperationInterface* operation); | |
| 100 | |
| 101 // Handles a request for downloading a file. Reads a file from the test | 95 // Handles a request for downloading a file. Reads a file from the test |
| 102 // directory and returns the content. Also, copies the |request| to the memory | 96 // directory and returns the content. Also, copies the |request| to the memory |
| 103 // pointed by |out_request|. | 97 // pointed by |out_request|. |
| 104 // |base_url| must be set to the server's base url. | 98 // |base_url| must be set to the server's base url. |
| 105 scoped_ptr<net::test_server::HttpResponse> HandleDownloadRequest( | 99 scoped_ptr<net::test_server::HttpResponse> HandleDownloadRequest( |
| 106 const GURL& base_url, | 100 const GURL& base_url, |
| 107 net::test_server::HttpRequest* out_request, | 101 net::test_server::HttpRequest* out_request, |
| 108 const net::test_server::HttpRequest& request); | 102 const net::test_server::HttpRequest& request); |
| 109 | 103 |
| 110 // Returns true if |json_data| is not NULL and equals to the content in | 104 // Returns true if |json_data| is not NULL and equals to the content in |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 const GetContentCallback callback_; | 305 const GetContentCallback callback_; |
| 312 ScopedVector<std::string> data_; | 306 ScopedVector<std::string> data_; |
| 313 | 307 |
| 314 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); | 308 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); |
| 315 }; | 309 }; |
| 316 | 310 |
| 317 } // namespace test_util | 311 } // namespace test_util |
| 318 } // namespace google_apis | 312 } // namespace google_apis |
| 319 | 313 |
| 320 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ | 314 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ |
| OLD | NEW |