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

Side by Side Diff: components/drive/service/fake_drive_service.h

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 COMPONENTS_DRIVE_SERVICE_FAKE_DRIVE_SERVICE_H_ 5 #ifndef COMPONENTS_DRIVE_SERVICE_FAKE_DRIVE_SERVICE_H_
6 #define COMPONENTS_DRIVE_SERVICE_FAKE_DRIVE_SERVICE_H_ 6 #define COMPONENTS_DRIVE_SERVICE_FAKE_DRIVE_SERVICE_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h"
11 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
12 #include "components/drive/service/drive_service_interface.h" 15 #include "components/drive/service/drive_service_interface.h"
13 16
14 namespace base { 17 namespace base {
15 class DictionaryValue; 18 class DictionaryValue;
16 } 19 }
17 20
18 namespace google_apis { 21 namespace google_apis {
19 class AboutResource; 22 class AboutResource;
20 class ChangeResource; 23 class ChangeResource;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 default_max_results_ = default_max_results; 75 default_max_results_ = default_max_results;
73 } 76 }
74 77
75 // Sets the url to the test server to be used as a base for generated share 78 // Sets the url to the test server to be used as a base for generated share
76 // urls to the share dialog. 79 // urls to the share dialog.
77 void set_share_url_base(const GURL& share_url_base) { 80 void set_share_url_base(const GURL& share_url_base) {
78 share_url_base_ = share_url_base; 81 share_url_base_ = share_url_base;
79 } 82 }
80 83
81 // Changes the quota fields returned from GetAboutResource(). 84 // Changes the quota fields returned from GetAboutResource().
82 void SetQuotaValue(int64 used, int64 total); 85 void SetQuotaValue(int64_t used, int64_t total);
83 86
84 // Returns the AboutResource. 87 // Returns the AboutResource.
85 const google_apis::AboutResource& about_resource() const { 88 const google_apis::AboutResource& about_resource() const {
86 return *about_resource_; 89 return *about_resource_;
87 } 90 }
88 91
89 // Returns the number of times the file list is successfully loaded by 92 // Returns the number of times the file list is successfully loaded by
90 // GetAllFileList(). 93 // GetAllFileList().
91 int file_list_load_count() const { return file_list_load_count_; } 94 int file_list_load_count() const { return file_list_load_count_; }
92 95
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // See the comment for EntryMatchWidthQuery() in .cc file for details about 153 // See the comment for EntryMatchWidthQuery() in .cc file for details about
151 // the supported search query types. 154 // the supported search query types.
152 google_apis::CancelCallback Search( 155 google_apis::CancelCallback Search(
153 const std::string& search_query, 156 const std::string& search_query,
154 const google_apis::FileListCallback& callback) override; 157 const google_apis::FileListCallback& callback) override;
155 google_apis::CancelCallback SearchByTitle( 158 google_apis::CancelCallback SearchByTitle(
156 const std::string& title, 159 const std::string& title,
157 const std::string& directory_resource_id, 160 const std::string& directory_resource_id,
158 const google_apis::FileListCallback& callback) override; 161 const google_apis::FileListCallback& callback) override;
159 google_apis::CancelCallback GetChangeList( 162 google_apis::CancelCallback GetChangeList(
160 int64 start_changestamp, 163 int64_t start_changestamp,
161 const google_apis::ChangeListCallback& callback) override; 164 const google_apis::ChangeListCallback& callback) override;
162 google_apis::CancelCallback GetRemainingChangeList( 165 google_apis::CancelCallback GetRemainingChangeList(
163 const GURL& next_link, 166 const GURL& next_link,
164 const google_apis::ChangeListCallback& callback) override; 167 const google_apis::ChangeListCallback& callback) override;
165 google_apis::CancelCallback GetRemainingFileList( 168 google_apis::CancelCallback GetRemainingFileList(
166 const GURL& next_link, 169 const GURL& next_link,
167 const google_apis::FileListCallback& callback) override; 170 const google_apis::FileListCallback& callback) override;
168 google_apis::CancelCallback GetFileResource( 171 google_apis::CancelCallback GetFileResource(
169 const std::string& resource_id, 172 const std::string& resource_id,
170 const google_apis::FileResourceCallback& callback) override; 173 const google_apis::FileResourceCallback& callback) override;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 const std::string& parent_resource_id, 214 const std::string& parent_resource_id,
212 const std::string& resource_id, 215 const std::string& resource_id,
213 const google_apis::EntryActionCallback& callback) override; 216 const google_apis::EntryActionCallback& callback) override;
214 google_apis::CancelCallback AddNewDirectory( 217 google_apis::CancelCallback AddNewDirectory(
215 const std::string& parent_resource_id, 218 const std::string& parent_resource_id,
216 const std::string& directory_title, 219 const std::string& directory_title,
217 const AddNewDirectoryOptions& options, 220 const AddNewDirectoryOptions& options,
218 const google_apis::FileResourceCallback& callback) override; 221 const google_apis::FileResourceCallback& callback) override;
219 google_apis::CancelCallback InitiateUploadNewFile( 222 google_apis::CancelCallback InitiateUploadNewFile(
220 const std::string& content_type, 223 const std::string& content_type,
221 int64 content_length, 224 int64_t content_length,
222 const std::string& parent_resource_id, 225 const std::string& parent_resource_id,
223 const std::string& title, 226 const std::string& title,
224 const UploadNewFileOptions& options, 227 const UploadNewFileOptions& options,
225 const google_apis::InitiateUploadCallback& callback) override; 228 const google_apis::InitiateUploadCallback& callback) override;
226 google_apis::CancelCallback InitiateUploadExistingFile( 229 google_apis::CancelCallback InitiateUploadExistingFile(
227 const std::string& content_type, 230 const std::string& content_type,
228 int64 content_length, 231 int64_t content_length,
229 const std::string& resource_id, 232 const std::string& resource_id,
230 const UploadExistingFileOptions& options, 233 const UploadExistingFileOptions& options,
231 const google_apis::InitiateUploadCallback& callback) override; 234 const google_apis::InitiateUploadCallback& callback) override;
232 google_apis::CancelCallback ResumeUpload( 235 google_apis::CancelCallback ResumeUpload(
233 const GURL& upload_url, 236 const GURL& upload_url,
234 int64 start_position, 237 int64_t start_position,
235 int64 end_position, 238 int64_t end_position,
236 int64 content_length, 239 int64_t content_length,
237 const std::string& content_type, 240 const std::string& content_type,
238 const base::FilePath& local_file_path, 241 const base::FilePath& local_file_path,
239 const google_apis::drive::UploadRangeCallback& callback, 242 const google_apis::drive::UploadRangeCallback& callback,
240 const google_apis::ProgressCallback& progress_callback) override; 243 const google_apis::ProgressCallback& progress_callback) override;
241 google_apis::CancelCallback GetUploadStatus( 244 google_apis::CancelCallback GetUploadStatus(
242 const GURL& upload_url, 245 const GURL& upload_url,
243 int64 content_length, 246 int64_t content_length,
244 const google_apis::drive::UploadRangeCallback& callback) override; 247 const google_apis::drive::UploadRangeCallback& callback) override;
245 google_apis::CancelCallback MultipartUploadNewFile( 248 google_apis::CancelCallback MultipartUploadNewFile(
246 const std::string& content_type, 249 const std::string& content_type,
247 int64 content_length, 250 int64_t content_length,
248 const std::string& parent_resource_id, 251 const std::string& parent_resource_id,
249 const std::string& title, 252 const std::string& title,
250 const base::FilePath& local_file_path, 253 const base::FilePath& local_file_path,
251 const UploadNewFileOptions& options, 254 const UploadNewFileOptions& options,
252 const google_apis::FileResourceCallback& callback, 255 const google_apis::FileResourceCallback& callback,
253 const google_apis::ProgressCallback& progress_callback) override; 256 const google_apis::ProgressCallback& progress_callback) override;
254 google_apis::CancelCallback MultipartUploadExistingFile( 257 google_apis::CancelCallback MultipartUploadExistingFile(
255 const std::string& content_type, 258 const std::string& content_type,
256 int64 content_length, 259 int64_t content_length,
257 const std::string& resource_id, 260 const std::string& resource_id,
258 const base::FilePath& local_file_path, 261 const base::FilePath& local_file_path,
259 const UploadExistingFileOptions& options, 262 const UploadExistingFileOptions& options,
260 const google_apis::FileResourceCallback& callback, 263 const google_apis::FileResourceCallback& callback,
261 const google_apis::ProgressCallback& progress_callback) override; 264 const google_apis::ProgressCallback& progress_callback) override;
262 google_apis::CancelCallback AuthorizeApp( 265 google_apis::CancelCallback AuthorizeApp(
263 const std::string& resource_id, 266 const std::string& resource_id,
264 const std::string& app_id, 267 const std::string& app_id,
265 const google_apis::AuthorizeAppCallback& callback) override; 268 const google_apis::AuthorizeAppCallback& callback) override;
266 google_apis::CancelCallback UninstallApp( 269 google_apis::CancelCallback UninstallApp(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 const std::string& content_data, 358 const std::string& content_data,
356 const std::string& parent_resource_id, 359 const std::string& parent_resource_id,
357 const std::string& title, 360 const std::string& title,
358 bool shared_with_me); 361 bool shared_with_me);
359 362
360 // Core implementation of GetChangeList. 363 // Core implementation of GetChangeList.
361 // This method returns the slice of the all matched entries, and its range 364 // This method returns the slice of the all matched entries, and its range
362 // is between |start_offset| (inclusive) and |start_offset| + |max_results| 365 // is between |start_offset| (inclusive) and |start_offset| + |max_results|
363 // (exclusive). 366 // (exclusive).
364 // Increments *load_counter by 1 before it returns successfully. 367 // Increments *load_counter by 1 before it returns successfully.
365 void GetChangeListInternal( 368 void GetChangeListInternal(int64_t start_changestamp,
366 int64 start_changestamp, 369 const std::string& search_query,
367 const std::string& search_query, 370 const std::string& directory_resource_id,
368 const std::string& directory_resource_id, 371 int start_offset,
369 int start_offset, 372 int max_results,
370 int max_results, 373 int* load_counter,
371 int* load_counter, 374 const google_apis::ChangeListCallback& callback);
372 const google_apis::ChangeListCallback& callback);
373 375
374 // Returns new upload session URL. 376 // Returns new upload session URL.
375 GURL GetNewUploadSessionUrl(); 377 GURL GetNewUploadSessionUrl();
376 378
377 void NotifyObservers(); 379 void NotifyObservers();
378 380
379 // The class is expected to run on UI thread. 381 // The class is expected to run on UI thread.
380 base::ThreadChecker thread_checker_; 382 base::ThreadChecker thread_checker_;
381 383
382 typedef std::map<std::string, EntryInfo*> EntryInfoMap; 384 typedef std::map<std::string, EntryInfo*> EntryInfoMap;
383 EntryInfoMap entries_; 385 EntryInfoMap entries_;
384 scoped_ptr<google_apis::AboutResource> about_resource_; 386 scoped_ptr<google_apis::AboutResource> about_resource_;
385 scoped_ptr<base::DictionaryValue> app_info_value_; 387 scoped_ptr<base::DictionaryValue> app_info_value_;
386 std::map<GURL, UploadSession> upload_sessions_; 388 std::map<GURL, UploadSession> upload_sessions_;
387 int64 published_date_seq_; 389 int64_t published_date_seq_;
388 int64 next_upload_sequence_number_; 390 int64_t next_upload_sequence_number_;
389 int default_max_results_; 391 int default_max_results_;
390 int resource_id_count_; 392 int resource_id_count_;
391 int file_list_load_count_; 393 int file_list_load_count_;
392 int change_list_load_count_; 394 int change_list_load_count_;
393 int directory_load_count_; 395 int directory_load_count_;
394 int about_resource_load_count_; 396 int about_resource_load_count_;
395 int app_list_load_count_; 397 int app_list_load_count_;
396 int blocked_file_list_load_count_; 398 int blocked_file_list_load_count_;
397 bool offline_; 399 bool offline_;
398 bool never_return_all_file_list_; 400 bool never_return_all_file_list_;
399 base::FilePath last_cancelled_file_; 401 base::FilePath last_cancelled_file_;
400 GURL share_url_base_; 402 GURL share_url_base_;
401 std::string app_json_template_; 403 std::string app_json_template_;
402 std::string open_url_format_; 404 std::string open_url_format_;
403 405
404 base::ObserverList<ChangeObserver> change_observers_; 406 base::ObserverList<ChangeObserver> change_observers_;
405 407
406 base::WeakPtrFactory<FakeDriveService> weak_ptr_factory_; 408 base::WeakPtrFactory<FakeDriveService> weak_ptr_factory_;
407 409
408 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); 410 DISALLOW_COPY_AND_ASSIGN(FakeDriveService);
409 }; 411 };
410 412
411 } // namespace drive 413 } // namespace drive
412 414
413 #endif // COMPONENTS_DRIVE_SERVICE_FAKE_DRIVE_SERVICE_H_ 415 #endif // COMPONENTS_DRIVE_SERVICE_FAKE_DRIVE_SERVICE_H_
OLDNEW
« no previous file with comments | « components/drive/service/dummy_drive_service.cc ('k') | components/drive/service/fake_drive_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698