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

Side by Side Diff: chrome/browser/chromeos/drive/fake_file_system.h

Issue 14755002: drive: Drop "Drive" from FakeDriveFileSystem and MockDriveFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some more cleanup Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_CHROMEOS_DRIVE_FAKE_DRIVE_FILE_SYSTEM_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FILE_SYSTEM_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_DRIVE_FILE_SYSTEM_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FILE_SYSTEM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 14 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
15 #include "chrome/browser/chromeos/drive/file_errors.h" 15 #include "chrome/browser/chromeos/drive/file_errors.h"
16 #include "chrome/browser/google_apis/gdata_errorcode.h" 16 #include "chrome/browser/google_apis/gdata_errorcode.h"
(...skipping 12 matching lines...) Expand all
29 class FileSystemObserver; 29 class FileSystemObserver;
30 30
31 namespace test_util { 31 namespace test_util {
32 32
33 // This class implements a fake DriveFileSystem which acts like a real Drive 33 // This class implements a fake DriveFileSystem which acts like a real Drive
34 // file system with FakeDriveService, for testing purpose. 34 // file system with FakeDriveService, for testing purpose.
35 // Note that this class doesn't support "caching" at the moment, so the number 35 // Note that this class doesn't support "caching" at the moment, so the number
36 // of interactions to the FakeDriveService may be bigger than the real 36 // of interactions to the FakeDriveService may be bigger than the real
37 // implementation. 37 // implementation.
38 // Currently most methods are empty (not implemented). 38 // Currently most methods are empty (not implemented).
39 class FakeDriveFileSystem : public DriveFileSystemInterface { 39 class FakeFileSystem : public DriveFileSystemInterface {
40 public: 40 public:
41 explicit FakeDriveFileSystem( 41 explicit FakeFileSystem(
42 google_apis::DriveServiceInterface* drive_service); 42 google_apis::DriveServiceInterface* drive_service);
43 virtual ~FakeDriveFileSystem(); 43 virtual ~FakeFileSystem();
44 44
45 // Initialization for testing. This can be called instead of Initialize 45 // Initialization for testing. This can be called instead of Initialize
46 // for testing purpose. Returns true for success. 46 // for testing purpose. Returns true for success.
47 bool InitializeForTesting(); 47 bool InitializeForTesting();
48 48
49 // DriveFileSystemInterface Overrides. 49 // DriveFileSystemInterface Overrides.
50 virtual void Initialize() OVERRIDE; 50 virtual void Initialize() OVERRIDE;
51 virtual void AddObserver(FileSystemObserver* observer) OVERRIDE; 51 virtual void AddObserver(FileSystemObserver* observer) OVERRIDE;
52 virtual void RemoveObserver(FileSystemObserver* observer) OVERRIDE; 52 virtual void RemoveObserver(FileSystemObserver* observer) OVERRIDE;
53 virtual void CheckForUpdates() OVERRIDE; 53 virtual void CheckForUpdates() OVERRIDE;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 const base::FilePath& temp_file); 203 const base::FilePath& temp_file);
204 204
205 // Helpers of GetEntryInfoByPath. 205 // Helpers of GetEntryInfoByPath.
206 // How the method works: 206 // How the method works:
207 // 1) If the path is root, gets AboutResrouce from the drive service 207 // 1) If the path is root, gets AboutResrouce from the drive service
208 // and create DriveEntryProto. 208 // and create DriveEntryProto.
209 // 2-1) Otherwise, gets the parent's DriveEntryProto by recursive call. 209 // 2-1) Otherwise, gets the parent's DriveEntryProto by recursive call.
210 // 2-2) Then, gets the resource list by restricting the parent with its id. 210 // 2-2) Then, gets the resource list by restricting the parent with its id.
211 // 2-3) Search the results based on title, and return the DriveEntryProto. 211 // 2-3) Search the results based on title, and return the DriveEntryProto.
212 // Note that adding suffix (e.g. " (2)") for files sharing a same name is 212 // Note that adding suffix (e.g. " (2)") for files sharing a same name is
213 // not supported in FakeDriveFileSystem. Thus, even if the server has 213 // not supported in FakeFileSystem. Thus, even if the server has
214 // files sharing the same name under a directory, the second (or later) 214 // files sharing the same name under a directory, the second (or later)
215 // file cannot be taken with the suffixed name. 215 // file cannot be taken with the suffixed name.
216 void GetEntryInfoByPathAfterGetAboutResource( 216 void GetEntryInfoByPathAfterGetAboutResource(
217 const GetEntryInfoCallback& callback, 217 const GetEntryInfoCallback& callback,
218 google_apis::GDataErrorCode gdata_error, 218 google_apis::GDataErrorCode gdata_error,
219 scoped_ptr<google_apis::AboutResource> about_resource); 219 scoped_ptr<google_apis::AboutResource> about_resource);
220 void GetEntryInfoByPathAfterGetParentEntryInfo( 220 void GetEntryInfoByPathAfterGetParentEntryInfo(
221 const base::FilePath& base_name, 221 const base::FilePath& base_name,
222 const GetEntryInfoCallback& callback, 222 const GetEntryInfoCallback& callback,
223 FileError error, 223 FileError error,
224 scoped_ptr<DriveEntryProto> parent_entry_proto); 224 scoped_ptr<DriveEntryProto> parent_entry_proto);
225 void GetEntryInfoByPathAfterGetResourceList( 225 void GetEntryInfoByPathAfterGetResourceList(
226 const base::FilePath& base_name, 226 const base::FilePath& base_name,
227 const GetEntryInfoCallback& callback, 227 const GetEntryInfoCallback& callback,
228 google_apis::GDataErrorCode gdata_error, 228 google_apis::GDataErrorCode gdata_error,
229 scoped_ptr<google_apis::ResourceList> resource_list); 229 scoped_ptr<google_apis::ResourceList> resource_list);
230 230
231 google_apis::DriveServiceInterface* drive_service_; // Not owned. 231 google_apis::DriveServiceInterface* drive_service_; // Not owned.
232 base::ScopedTempDir cache_dir_; 232 base::ScopedTempDir cache_dir_;
233 233
234 // Note: This should remain the last member so it'll be destroyed and 234 // Note: This should remain the last member so it'll be destroyed and
235 // invalidate the weak pointers before any other members are destroyed. 235 // invalidate the weak pointers before any other members are destroyed.
236 base::WeakPtrFactory<FakeDriveFileSystem> weak_ptr_factory_; 236 base::WeakPtrFactory<FakeFileSystem> weak_ptr_factory_;
237 237
238 DISALLOW_COPY_AND_ASSIGN(FakeDriveFileSystem); 238 DISALLOW_COPY_AND_ASSIGN(FakeFileSystem);
239 }; 239 };
240 240
241 } // namespace test_util 241 } // namespace test_util
242 } // namespace drive 242 } // namespace drive
243 243
244 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_DRIVE_FILE_SYSTEM_H_ 244 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FILE_SYSTEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/fake_drive_file_system_unittest.cc ('k') | chrome/browser/chromeos/drive/fake_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698