| 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 "chrome/browser/drive/drive_service_interface.h" | 9 #include "chrome/browser/drive/drive_service_interface.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // 2) Return valid responses based on the the in-memory resource list. | 27 // 2) Return valid responses based on the the in-memory resource list. |
| 28 // 3) Update the in-memory resource list by requests like DeleteResource(). | 28 // 3) Update the in-memory resource list by requests like DeleteResource(). |
| 29 class FakeDriveService : public DriveServiceInterface { | 29 class FakeDriveService : public DriveServiceInterface { |
| 30 public: | 30 public: |
| 31 FakeDriveService(); | 31 FakeDriveService(); |
| 32 virtual ~FakeDriveService(); | 32 virtual ~FakeDriveService(); |
| 33 | 33 |
| 34 // Loads the app list for Drive API. Returns true on success. | 34 // Loads the app list for Drive API. Returns true on success. |
| 35 bool LoadAppListForDriveApi(const std::string& relative_path); | 35 bool LoadAppListForDriveApi(const std::string& relative_path); |
| 36 | 36 |
| 37 // Adds an app to app list. |
| 38 void AddApp(const std::string& app_id, |
| 39 const std::string& app_name, |
| 40 const std::string& product_id, |
| 41 const std::string& create_url); |
| 42 |
| 43 // Removes an app by product id. |
| 44 void RemoveAppByProductId(const std::string& product_id); |
| 45 |
| 46 // Returns true if the service knows the given drive app id. |
| 47 bool HasApp(const std::string& app_id) const; |
| 48 |
| 37 // Changes the offline state. All functions fail with GDATA_NO_CONNECTION | 49 // Changes the offline state. All functions fail with GDATA_NO_CONNECTION |
| 38 // when offline. By default the offline state is false. | 50 // when offline. By default the offline state is false. |
| 39 void set_offline(bool offline) { offline_ = offline; } | 51 void set_offline(bool offline) { offline_ = offline; } |
| 40 | 52 |
| 41 // GetAllFileList never returns result when this is set to true. | 53 // GetAllFileList never returns result when this is set to true. |
| 42 // Used to emulate the real server's slowness. | 54 // Used to emulate the real server's slowness. |
| 43 void set_never_return_all_file_list(bool value) { | 55 void set_never_return_all_file_list(bool value) { |
| 44 never_return_all_file_list_ = value; | 56 never_return_all_file_list_ = value; |
| 45 } | 57 } |
| 46 | 58 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 int file_list_load_count_; | 340 int file_list_load_count_; |
| 329 int change_list_load_count_; | 341 int change_list_load_count_; |
| 330 int directory_load_count_; | 342 int directory_load_count_; |
| 331 int about_resource_load_count_; | 343 int about_resource_load_count_; |
| 332 int app_list_load_count_; | 344 int app_list_load_count_; |
| 333 int blocked_file_list_load_count_; | 345 int blocked_file_list_load_count_; |
| 334 bool offline_; | 346 bool offline_; |
| 335 bool never_return_all_file_list_; | 347 bool never_return_all_file_list_; |
| 336 base::FilePath last_cancelled_file_; | 348 base::FilePath last_cancelled_file_; |
| 337 GURL share_url_base_; | 349 GURL share_url_base_; |
| 350 std::string app_json_template_; |
| 338 | 351 |
| 339 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); | 352 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); |
| 340 }; | 353 }; |
| 341 | 354 |
| 342 } // namespace drive | 355 } // namespace drive |
| 343 | 356 |
| 344 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ | 357 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
| OLD | NEW |