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_DRIVE_FAKE_DRIVE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
6 #define CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ | 6 #define CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/drive/drive_service_interface.h" | 10 #include "chrome/browser/drive/drive_service_interface.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // specified. | 33 // specified. |
34 bool LoadAccountMetadataForWapi(const std::string& relative_path); | 34 bool LoadAccountMetadataForWapi(const std::string& relative_path); |
35 | 35 |
36 // Loads the app list for Drive API. Returns true on success. | 36 // Loads the app list for Drive API. Returns true on success. |
37 bool LoadAppListForDriveApi(const std::string& relative_path); | 37 bool LoadAppListForDriveApi(const std::string& relative_path); |
38 | 38 |
39 // Changes the offline state. All functions fail with GDATA_NO_CONNECTION | 39 // Changes the offline state. All functions fail with GDATA_NO_CONNECTION |
40 // when offline. By default the offline state is false. | 40 // when offline. By default the offline state is false. |
41 void set_offline(bool offline) { offline_ = offline; } | 41 void set_offline(bool offline) { offline_ = offline; } |
42 | 42 |
| 43 // GetAllResourceList never returns result when this is set to true. |
| 44 // Used to emulate the real server's slowness. |
| 45 void set_never_return_all_resource_list(bool value) { |
| 46 never_return_all_resource_list_ = value; |
| 47 } |
| 48 |
43 // Changes the default max results returned from GetResourceList(). | 49 // Changes the default max results returned from GetResourceList(). |
44 // By default, it's set to 0, which is unlimited. | 50 // By default, it's set to 0, which is unlimited. |
45 void set_default_max_results(int default_max_results) { | 51 void set_default_max_results(int default_max_results) { |
46 default_max_results_ = default_max_results; | 52 default_max_results_ = default_max_results; |
47 } | 53 } |
48 | 54 |
49 // Sets the url to the test server to be used as a base for generated share | 55 // Sets the url to the test server to be used as a base for generated share |
50 // urls to the share dialog. | 56 // urls to the share dialog. |
51 void set_share_url_base(const GURL& share_url_base) { | 57 void set_share_url_base(const GURL& share_url_base) { |
52 share_url_base_ = share_url_base; | 58 share_url_base_ = share_url_base; |
(...skipping 21 matching lines...) Expand all Loading... |
74 // Returns the number of times the about resource is successfully loaded | 80 // Returns the number of times the about resource is successfully loaded |
75 // by GetAboutResource(). | 81 // by GetAboutResource(). |
76 int about_resource_load_count() const { | 82 int about_resource_load_count() const { |
77 return about_resource_load_count_; | 83 return about_resource_load_count_; |
78 } | 84 } |
79 | 85 |
80 // Returns the number of times the app list is successfully loaded by | 86 // Returns the number of times the app list is successfully loaded by |
81 // GetAppList(). | 87 // GetAppList(). |
82 int app_list_load_count() const { return app_list_load_count_; } | 88 int app_list_load_count() const { return app_list_load_count_; } |
83 | 89 |
| 90 // Returns the number of times GetAllResourceList are blocked due to |
| 91 // set_never_return_all_resource_list(). |
| 92 int blocked_resource_list_load_count() const { |
| 93 return blocked_resource_list_load_count_; |
| 94 } |
| 95 |
84 // Returns the file path whose request is cancelled just before this method | 96 // Returns the file path whose request is cancelled just before this method |
85 // invocation. | 97 // invocation. |
86 const base::FilePath& last_cancelled_file() const { | 98 const base::FilePath& last_cancelled_file() const { |
87 return last_cancelled_file_; | 99 return last_cancelled_file_; |
88 } | 100 } |
89 | 101 |
90 // Returns the (fake) URL for the link. | 102 // Returns the (fake) URL for the link. |
91 static GURL GetFakeLinkUrl(const std::string& resource_id); | 103 static GURL GetFakeLinkUrl(const std::string& resource_id); |
92 | 104 |
93 // DriveServiceInterface Overrides | 105 // DriveServiceInterface Overrides |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 int64 largest_changestamp_; | 305 int64 largest_changestamp_; |
294 int64 published_date_seq_; | 306 int64 published_date_seq_; |
295 int64 next_upload_sequence_number_; | 307 int64 next_upload_sequence_number_; |
296 int default_max_results_; | 308 int default_max_results_; |
297 int resource_id_count_; | 309 int resource_id_count_; |
298 int resource_list_load_count_; | 310 int resource_list_load_count_; |
299 int change_list_load_count_; | 311 int change_list_load_count_; |
300 int directory_load_count_; | 312 int directory_load_count_; |
301 int about_resource_load_count_; | 313 int about_resource_load_count_; |
302 int app_list_load_count_; | 314 int app_list_load_count_; |
| 315 int blocked_resource_list_load_count_; |
303 bool offline_; | 316 bool offline_; |
| 317 bool never_return_all_resource_list_; |
304 base::FilePath last_cancelled_file_; | 318 base::FilePath last_cancelled_file_; |
305 GURL share_url_base_; | 319 GURL share_url_base_; |
306 | 320 |
307 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); | 321 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); |
308 }; | 322 }; |
309 | 323 |
310 } // namespace drive | 324 } // namespace drive |
311 | 325 |
312 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ | 326 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
OLD | NEW |