Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Side by Side Diff: chrome/browser/google_apis/test_util.h

Issue 15069003: Rename the embedded test server to EmbeddedTestServer in net::test_server namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 {
28 namespace test_server {
29 struct HttpRequest;
30 class HttpResponse;
31 }
32 }
33
27 namespace google_apis { 34 namespace google_apis {
28 35
29 class AboutResource; 36 class AboutResource;
30 class AccountMetadata; 37 class AccountMetadata;
31 class AppList; 38 class AppList;
32 class AuthenticatedOperationInterface; 39 class AuthenticatedOperationInterface;
33 class ResourceEntry; 40 class ResourceEntry;
34 class ResourceList; 41 class ResourceList;
35 struct UploadRangeResponse; 42 struct UploadRangeResponse;
36 43
37 namespace test_server {
38 struct HttpRequest;
39 class HttpResponse;
40 }
41
42 namespace test_util { 44 namespace test_util {
43 45
44 // Runs a task posted to the blocking pool, including subsequent tasks posted 46 // Runs a task posted to the blocking pool, including subsequent tasks posted
45 // to the UI message loop and the blocking pool. 47 // to the UI message loop and the blocking pool.
46 // 48 //
47 // A task is often posted to the blocking pool with PostTaskAndReply(). In 49 // A task is often posted to the blocking pool with PostTaskAndReply(). In
48 // that case, a task is posted back to the UI message loop, which can again 50 // that case, a task is posted back to the UI message loop, which can again
49 // post a task to the blocking pool. This function processes these tasks 51 // post a task to the blocking pool. This function processes these tasks
50 // repeatedly. 52 // repeatedly.
51 void RunBlockingPoolTask(); 53 void RunBlockingPoolTask();
(...skipping 28 matching lines...) Expand all
80 bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, 82 bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir,
81 size_t size, 83 size_t size,
82 base::FilePath* path, 84 base::FilePath* path,
83 std::string* data); 85 std::string* data);
84 86
85 // 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
86 // chrome/test/data. 88 // chrome/test/data.
87 scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path); 89 scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path);
88 90
89 // Returns a HttpResponse created from the given file path. 91 // Returns a HttpResponse created from the given file path.
90 scoped_ptr<test_server::HttpResponse> CreateHttpResponseFromFile( 92 scoped_ptr<net::test_server::HttpResponse> CreateHttpResponseFromFile(
91 const base::FilePath& file_path); 93 const base::FilePath& file_path);
92 94
93 // Does nothing for ReAuthenticateCallback(). This function should be used 95 // Does nothing for ReAuthenticateCallback(). This function should be used
94 // if it is not expected to reach this method as there won't be any 96 // if it is not expected to reach this method as there won't be any
95 // authentication failures in the test. 97 // authentication failures in the test.
96 void DoNothingForReAuthenticateCallback( 98 void DoNothingForReAuthenticateCallback(
97 AuthenticatedOperationInterface* operation); 99 AuthenticatedOperationInterface* operation);
98 100
99 // Handles a request for downloading a file. Reads a file from the test 101 // Handles a request for downloading a file. Reads a file from the test
100 // directory and returns the content. Also, copies the |request| to the memory 102 // directory and returns the content. Also, copies the |request| to the memory
101 // pointed by |out_request|. 103 // pointed by |out_request|.
102 // |base_url| must be set to the server's base url. 104 // |base_url| must be set to the server's base url.
103 scoped_ptr<test_server::HttpResponse> HandleDownloadRequest( 105 scoped_ptr<net::test_server::HttpResponse> HandleDownloadRequest(
104 const GURL& base_url, 106 const GURL& base_url,
105 test_server::HttpRequest* out_request, 107 net::test_server::HttpRequest* out_request,
106 const test_server::HttpRequest& request); 108 const net::test_server::HttpRequest& request);
107 109
108 // Returns true if |json_data| is not NULL and equals to the content in 110 // Returns true if |json_data| is not NULL and equals to the content in
109 // |expected_json_file_path|. The failure reason will be logged into LOG(ERROR) 111 // |expected_json_file_path|. The failure reason will be logged into LOG(ERROR)
110 // if necessary. 112 // if necessary.
111 bool VerifyJsonData(const base::FilePath& expected_json_file_path, 113 bool VerifyJsonData(const base::FilePath& expected_json_file_path,
112 const base::Value* json_data); 114 const base::Value* json_data);
113 115
114 // Parses a value of Content-Range header, which looks like 116 // Parses a value of Content-Range header, which looks like
115 // "bytes <start_position>-<end_position>/<length>". 117 // "bytes <start_position>-<end_position>/<length>".
116 // Returns true on success. 118 // Returns true on success.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const GetContentCallback callback_; 311 const GetContentCallback callback_;
310 ScopedVector<std::string> data_; 312 ScopedVector<std::string> data_;
311 313
312 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); 314 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback);
313 }; 315 };
314 316
315 } // namespace test_util 317 } // namespace test_util
316 } // namespace google_apis 318 } // namespace google_apis
317 319
318 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ 320 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_operations_unittest.cc ('k') | chrome/browser/google_apis/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698