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 // This file contains mocks for classes in drive_service_interface.h | 5 // This file contains mocks for classes in drive_service_interface.h |
6 | 6 |
7 #ifndef CHROME_BROWSER_GOOGLE_APIS_MOCK_DRIVE_SERVICE_H_ | 7 #ifndef CHROME_BROWSER_GOOGLE_APIS_MOCK_DRIVE_SERVICE_H_ |
8 #define CHROME_BROWSER_GOOGLE_APIS_MOCK_DRIVE_SERVICE_H_ | 8 #define CHROME_BROWSER_GOOGLE_APIS_MOCK_DRIVE_SERVICE_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/google_apis/drive_service_interface.h" | 13 #include "chrome/browser/google_apis/drive_service_interface.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
15 | 15 |
| 16 namespace base { |
16 class FilePath; | 17 class FilePath; |
| 18 } |
17 | 19 |
18 namespace google_apis { | 20 namespace google_apis { |
19 | 21 |
20 class MockDriveService : public DriveServiceInterface { | 22 class MockDriveService : public DriveServiceInterface { |
21 public: | 23 public: |
22 // DriveService is usually owned and created by DriveFileSystem. | 24 // DriveService is usually owned and created by DriveFileSystem. |
23 MockDriveService(); | 25 MockDriveService(); |
24 virtual ~MockDriveService(); | 26 virtual ~MockDriveService(); |
25 | 27 |
26 // DriveServiceInterface overrides. | 28 // DriveServiceInterface overrides. |
27 MOCK_METHOD1(Initialize, void(Profile* profile)); | 29 MOCK_METHOD1(Initialize, void(Profile* profile)); |
28 MOCK_METHOD1(AddObserver, void(DriveServiceObserver* observer)); | 30 MOCK_METHOD1(AddObserver, void(DriveServiceObserver* observer)); |
29 MOCK_METHOD1(RemoveObserver, | 31 MOCK_METHOD1(RemoveObserver, |
30 void(DriveServiceObserver* observer)); | 32 void(DriveServiceObserver* observer)); |
31 MOCK_CONST_METHOD0(CanStartOperation, bool()); | 33 MOCK_CONST_METHOD0(CanStartOperation, bool()); |
32 MOCK_METHOD0(CancelAll, void(void)); | 34 MOCK_METHOD0(CancelAll, void(void)); |
33 MOCK_METHOD1(CancelForFilePath, bool(const FilePath& file_path)); | 35 MOCK_METHOD1(CancelForFilePath, bool(const base::FilePath& file_path)); |
34 MOCK_CONST_METHOD0(GetProgressStatusList, | 36 MOCK_CONST_METHOD0(GetProgressStatusList, |
35 OperationProgressStatusList()); | 37 OperationProgressStatusList()); |
36 MOCK_CONST_METHOD0(GetRootResourceId, std::string()); | 38 MOCK_CONST_METHOD0(GetRootResourceId, std::string()); |
37 MOCK_METHOD6(GetResourceList, | 39 MOCK_METHOD6(GetResourceList, |
38 void(const GURL& feed_url, | 40 void(const GURL& feed_url, |
39 int64 start_changestamp, | 41 int64 start_changestamp, |
40 const std::string& search_string, | 42 const std::string& search_string, |
41 bool shared_with_me, | 43 bool shared_with_me, |
42 const std::string& directory_resource_id, | 44 const std::string& directory_resource_id, |
43 const GetResourceListCallback& callback)); | 45 const GetResourceListCallback& callback)); |
(...skipping 21 matching lines...) Expand all Loading... |
65 MOCK_METHOD3(RemoveResourceFromDirectory, | 67 MOCK_METHOD3(RemoveResourceFromDirectory, |
66 void(const std::string& parent_resource_id, | 68 void(const std::string& parent_resource_id, |
67 const std::string& resource_id, | 69 const std::string& resource_id, |
68 const EntryActionCallback& callback)); | 70 const EntryActionCallback& callback)); |
69 MOCK_METHOD3(AddNewDirectory, | 71 MOCK_METHOD3(AddNewDirectory, |
70 void(const std::string& parent_resource_id, | 72 void(const std::string& parent_resource_id, |
71 const std::string& directory_name, | 73 const std::string& directory_name, |
72 const GetResourceEntryCallback& callback)); | 74 const GetResourceEntryCallback& callback)); |
73 MOCK_METHOD5( | 75 MOCK_METHOD5( |
74 DownloadFile, | 76 DownloadFile, |
75 void(const FilePath& virtual_path, | 77 void(const base::FilePath& virtual_path, |
76 const FilePath& local_cache_path, | 78 const base::FilePath& local_cache_path, |
77 const GURL& content_url, | 79 const GURL& content_url, |
78 const DownloadActionCallback& | 80 const DownloadActionCallback& |
79 donwload_action_callback, | 81 donwload_action_callback, |
80 const GetContentCallback& get_content_callback)); | 82 const GetContentCallback& get_content_callback)); |
81 MOCK_METHOD2(InitiateUpload, | 83 MOCK_METHOD2(InitiateUpload, |
82 void(const InitiateUploadParams& upload_file_info, | 84 void(const InitiateUploadParams& upload_file_info, |
83 const InitiateUploadCallback& callback)); | 85 const InitiateUploadCallback& callback)); |
84 MOCK_METHOD2(ResumeUpload, | 86 MOCK_METHOD2(ResumeUpload, |
85 void(const ResumeUploadParams& upload_file_info, | 87 void(const ResumeUploadParams& upload_file_info, |
86 const ResumeUploadCallback& callback)); | 88 const ResumeUploadCallback& callback)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Will call |callback| with HTTP_SUCCESS and the current value of | 146 // Will call |callback| with HTTP_SUCCESS and the current value of |
145 // |directory_data_|. | 147 // |directory_data_|. |
146 void CreateDirectoryStub(const std::string& parent_resource_id, | 148 void CreateDirectoryStub(const std::string& parent_resource_id, |
147 const std::string& directory_name, | 149 const std::string& directory_name, |
148 const GetResourceEntryCallback& callback); | 150 const GetResourceEntryCallback& callback); |
149 | 151 |
150 // Will call |callback| with HTTP_SUCCESS, the given URL, and the host+path | 152 // Will call |callback| with HTTP_SUCCESS, the given URL, and the host+path |
151 // portion of the URL as the temporary file path. If |file_data_| is not null, | 153 // portion of the URL as the temporary file path. If |file_data_| is not null, |
152 // |file_data_| is written to the temporary file. | 154 // |file_data_| is written to the temporary file. |
153 void DownloadFileStub( | 155 void DownloadFileStub( |
154 const FilePath& virtual_path, | 156 const base::FilePath& virtual_path, |
155 const FilePath& local_tmp_path, | 157 const base::FilePath& local_tmp_path, |
156 const GURL& content_url, | 158 const GURL& content_url, |
157 const DownloadActionCallback& download_action_callback, | 159 const DownloadActionCallback& download_action_callback, |
158 const GetContentCallback& get_content_callback); | 160 const GetContentCallback& get_content_callback); |
159 | 161 |
160 // Account meta data to be returned from GetAccountMetadata. | 162 // Account meta data to be returned from GetAccountMetadata. |
161 scoped_ptr<base::Value> account_metadata_data_; | 163 scoped_ptr<base::Value> account_metadata_data_; |
162 | 164 |
163 // Feed data to be returned from GetResourceList. | 165 // Feed data to be returned from GetResourceList. |
164 scoped_ptr<base::Value> feed_data_; | 166 scoped_ptr<base::Value> feed_data_; |
165 | 167 |
166 // Feed data to be returned from CreateDirectory. | 168 // Feed data to be returned from CreateDirectory. |
167 scoped_ptr<base::Value> directory_data_; | 169 scoped_ptr<base::Value> directory_data_; |
168 | 170 |
169 // Feed data to be returned from CopyHostedDocument. | 171 // Feed data to be returned from CopyHostedDocument. |
170 scoped_ptr<base::Value> document_data_; | 172 scoped_ptr<base::Value> document_data_; |
171 | 173 |
172 // Feed data to be returned from GetResourceList if the search path is | 174 // Feed data to be returned from GetResourceList if the search path is |
173 // specified. The feed contains subset of the root_feed. | 175 // specified. The feed contains subset of the root_feed. |
174 scoped_ptr<base::Value> search_result_; | 176 scoped_ptr<base::Value> search_result_; |
175 | 177 |
176 // File data to be written to the local temporary file when | 178 // File data to be written to the local temporary file when |
177 // DownloadFileStub is called. | 179 // DownloadFileStub is called. |
178 scoped_ptr<std::string> file_data_; | 180 scoped_ptr<std::string> file_data_; |
179 }; | 181 }; |
180 | 182 |
181 } // namespace google_apis | 183 } // namespace google_apis |
182 | 184 |
183 #endif // CHROME_BROWSER_GOOGLE_APIS_MOCK_DRIVE_SERVICE_H_ | 185 #endif // CHROME_BROWSER_GOOGLE_APIS_MOCK_DRIVE_SERVICE_H_ |
OLD | NEW |