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_FAKE_DRIVE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ |
7 | 7 |
| 8 #include "base/values.h" |
8 #include "chrome/browser/google_apis/drive_service_interface.h" | 9 #include "chrome/browser/google_apis/drive_service_interface.h" |
9 | 10 |
10 namespace google_apis { | 11 namespace google_apis { |
11 | 12 |
12 // This class implements a fake DriveService which acts like a real Drive | 13 // This class implements a fake DriveService which acts like a real Drive |
13 // service. The fake service works as follows: | 14 // service. The fake service works as follows: |
14 // | 15 // |
15 // 1) Load JSON files and construct the in-memory resource list. | 16 // 1) Load JSON files and construct the in-memory resource list. |
16 // 2) Return valid responses based on the the in-memory resource list. | 17 // 2) Return valid responses based on the the in-memory resource list. |
17 // 3) Update the in-memory resource list by operations like DeleteResource(). | 18 // 3) Update the in-memory resource list by operations like DeleteResource(). |
18 // | 19 // |
19 // TODO(satorux): Implement the advertised behaviors. crbug.com/162350 | 20 // TODO(satorux): Implement the advertised behaviors. crbug.com/162350 |
20 class FakeDriveService : public DriveServiceInterface { | 21 class FakeDriveService : public DriveServiceInterface { |
21 public: | 22 public: |
22 FakeDriveService(); | 23 FakeDriveService(); |
23 virtual ~FakeDriveService(); | 24 virtual ~FakeDriveService(); |
24 | 25 |
| 26 // Loads the resource list for WAPI. Returns true on success. |
| 27 bool LoadResourceListForWapi(const std::string& relative_path); |
| 28 |
| 29 // Loads the account metadata for WAPI. Returns true on success. |
| 30 bool LoadAccountMetadataForWapi(const std::string& relative_path); |
| 31 |
25 // DriveServiceInterface Overrides | 32 // DriveServiceInterface Overrides |
26 virtual void Initialize(Profile* profile) OVERRIDE; | 33 virtual void Initialize(Profile* profile) OVERRIDE; |
27 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 34 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
28 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; | 35 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; |
29 virtual bool CanStartOperation() const OVERRIDE; | 36 virtual bool CanStartOperation() const OVERRIDE; |
30 virtual void CancelAll() OVERRIDE; | 37 virtual void CancelAll() OVERRIDE; |
31 virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; | 38 virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; |
32 virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; | 39 virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; |
33 virtual bool HasAccessToken() const OVERRIDE; | 40 virtual bool HasAccessToken() const OVERRIDE; |
34 virtual bool HasRefreshToken() const OVERRIDE; | 41 virtual bool HasRefreshToken() const OVERRIDE; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const GURL& parent_content_url, | 85 const GURL& parent_content_url, |
79 const FilePath::StringType& directory_name, | 86 const FilePath::StringType& directory_name, |
80 const GetResourceEntryCallback& callback) OVERRIDE; | 87 const GetResourceEntryCallback& callback) OVERRIDE; |
81 virtual void InitiateUpload(const InitiateUploadParams& params, | 88 virtual void InitiateUpload(const InitiateUploadParams& params, |
82 const InitiateUploadCallback& callback) OVERRIDE; | 89 const InitiateUploadCallback& callback) OVERRIDE; |
83 virtual void ResumeUpload(const ResumeUploadParams& params, | 90 virtual void ResumeUpload(const ResumeUploadParams& params, |
84 const ResumeUploadCallback& callback) OVERRIDE; | 91 const ResumeUploadCallback& callback) OVERRIDE; |
85 virtual void AuthorizeApp(const GURL& edit_url, | 92 virtual void AuthorizeApp(const GURL& edit_url, |
86 const std::string& app_id, | 93 const std::string& app_id, |
87 const AuthorizeAppCallback& callback) OVERRIDE; | 94 const AuthorizeAppCallback& callback) OVERRIDE; |
| 95 |
| 96 private: |
| 97 scoped_ptr<base::Value> resource_list_value_; |
| 98 scoped_ptr<base::Value> account_metadata_value_; |
| 99 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); |
88 }; | 100 }; |
89 | 101 |
90 } // namespace google_apis | 102 } // namespace google_apis |
91 | 103 |
92 #endif // CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ | 104 #endif // CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ |
OLD | NEW |