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 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/google_apis/gdata_errorcode.h" | 11 #include "chrome/browser/google_apis/gdata_errorcode.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 class FilePath; | 14 class FilePath; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class Value; | 17 class Value; |
18 } | 18 } |
19 | 19 |
20 namespace google_apis { | 20 namespace google_apis { |
21 | 21 |
22 class AccountMetadataFeed; | 22 class AccountMetadataFeed; |
| 23 class AuthenticatedOperationInterface; |
23 class ResourceEntry; | 24 class ResourceEntry; |
24 class ResourceList; | 25 class ResourceList; |
25 | 26 |
26 namespace test_server { | 27 namespace test_server { |
27 class HttpResponse; | 28 class HttpResponse; |
28 } | 29 } |
29 | 30 |
30 namespace test_util { | 31 namespace test_util { |
31 | 32 |
32 // Runs a task posted to the blocking pool, including subsequent tasks posted | 33 // Runs a task posted to the blocking pool, including subsequent tasks posted |
(...skipping 20 matching lines...) Expand all Loading... |
53 // Copies the results from EntryActionCallback. | 54 // Copies the results from EntryActionCallback. |
54 void CopyResultsFromEntryActionCallback(GDataErrorCode* error_out, | 55 void CopyResultsFromEntryActionCallback(GDataErrorCode* error_out, |
55 GDataErrorCode error_in); | 56 GDataErrorCode error_in); |
56 | 57 |
57 // Copies the results from GetDataCallback. | 58 // Copies the results from GetDataCallback. |
58 void CopyResultsFromGetDataCallback(GDataErrorCode* error_out, | 59 void CopyResultsFromGetDataCallback(GDataErrorCode* error_out, |
59 scoped_ptr<base::Value>* value_out, | 60 scoped_ptr<base::Value>* value_out, |
60 GDataErrorCode error_in, | 61 GDataErrorCode error_in, |
61 scoped_ptr<base::Value> value_in); | 62 scoped_ptr<base::Value> value_in); |
62 | 63 |
| 64 // Copies the results from GetDataCallback and quit the message loop. |
| 65 void CopyResultsFromGetDataCallbackAndQuit(GDataErrorCode* error_out, |
| 66 scoped_ptr<base::Value>* value_out, |
| 67 GDataErrorCode error_in, |
| 68 scoped_ptr<base::Value> value_in); |
| 69 |
63 // Copies the results from GetResourceEntryCallback. | 70 // Copies the results from GetResourceEntryCallback. |
64 void CopyResultsFromGetResourceEntryCallback( | 71 void CopyResultsFromGetResourceEntryCallback( |
65 GDataErrorCode* error_out, | 72 GDataErrorCode* error_out, |
66 scoped_ptr<ResourceEntry>* resource_entry_out, | 73 scoped_ptr<ResourceEntry>* resource_entry_out, |
67 GDataErrorCode error_in, | 74 GDataErrorCode error_in, |
68 scoped_ptr<ResourceEntry> resource_entry_in); | 75 scoped_ptr<ResourceEntry> resource_entry_in); |
69 | 76 |
70 // Copies the results from GetResourceListCallback. | 77 // Copies the results from GetResourceListCallback. |
71 void CopyResultsFromGetResourceListCallback( | 78 void CopyResultsFromGetResourceListCallback( |
72 GDataErrorCode* error_out, | 79 GDataErrorCode* error_out, |
73 scoped_ptr<ResourceList>* resource_list_out, | 80 scoped_ptr<ResourceList>* resource_list_out, |
74 GDataErrorCode error_in, | 81 GDataErrorCode error_in, |
75 scoped_ptr<ResourceList> resource_list_in); | 82 scoped_ptr<ResourceList> resource_list_in); |
76 | 83 |
77 // Copies the results from GetAccountMetadataCallback. | 84 // Copies the results from GetAccountMetadataCallback. |
78 void CopyResultsFromGetAccountMetadataCallback( | 85 void CopyResultsFromGetAccountMetadataCallback( |
79 GDataErrorCode* error_out, | 86 GDataErrorCode* error_out, |
80 scoped_ptr<AccountMetadataFeed>* account_metadata_out, | 87 scoped_ptr<AccountMetadataFeed>* account_metadata_out, |
81 GDataErrorCode error_in, | 88 GDataErrorCode error_in, |
82 scoped_ptr<AccountMetadataFeed> account_metadata_in); | 89 scoped_ptr<AccountMetadataFeed> account_metadata_in); |
83 | 90 |
84 // Returns a HttpResponse created from the given file path. | 91 // Returns a HttpResponse created from the given file path. |
85 scoped_ptr<test_server::HttpResponse> CreateHttpResponseFromFile( | 92 scoped_ptr<test_server::HttpResponse> CreateHttpResponseFromFile( |
86 const FilePath& file_path); | 93 const FilePath& file_path); |
87 | 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 // Returns true if |json_data| is not NULL and equals to the content in |
| 102 // |expected_json_file_path|. The failure reason will be logged into LOG(ERROR) |
| 103 // if necessary. |
| 104 bool VerifyJsonData(const FilePath& expected_json_file_path, |
| 105 const base::Value* json_data); |
| 106 |
88 } // namespace test_util | 107 } // namespace test_util |
89 } // namespace google_apis | 108 } // namespace google_apis |
90 | 109 |
91 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ | 110 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_UTIL_H_ |
OLD | NEW |