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

Side by Side Diff: chrome/browser/sync_file_system/local/canned_syncable_file_system.h

Issue 145693005: [FileAPI] Replace default leveldb::Env with leveldb::MemEnv in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 17 matching lines...) Expand all
28 class SingleThreadTaskRunner; 28 class SingleThreadTaskRunner;
29 class Thread; 29 class Thread;
30 } 30 }
31 31
32 namespace fileapi { 32 namespace fileapi {
33 class FileSystemContext; 33 class FileSystemContext;
34 class FileSystemOperationRunner; 34 class FileSystemOperationRunner;
35 class FileSystemURL; 35 class FileSystemURL;
36 } 36 }
37 37
38 namespace leveldb {
39 class Env;
40 }
41
38 namespace net { 42 namespace net {
39 class URLRequestContext; 43 class URLRequestContext;
40 } 44 }
41 45
42 namespace quota { 46 namespace quota {
43 class QuotaManager; 47 class QuotaManager;
44 } 48 }
45 49
46 namespace sync_file_system { 50 namespace sync_file_system {
47 51
48 class FileChangeList; 52 class FileChangeList;
49 class LocalFileSyncContext; 53 class LocalFileSyncContext;
50 class SyncFileSystemBackend; 54 class SyncFileSystemBackend;
51 55
52 // A canned syncable filesystem for testing. 56 // A canned syncable filesystem for testing.
53 // This internally creates its own QuotaManager and FileSystemContext 57 // This internally creates its own QuotaManager and FileSystemContext
54 // (as we do so for each isolated application). 58 // (as we do so for each isolated application).
55 class CannedSyncableFileSystem 59 class CannedSyncableFileSystem
56 : public LocalFileSyncStatus::Observer { 60 : public LocalFileSyncStatus::Observer {
57 public: 61 public:
58 typedef base::Callback<void(const GURL& root, 62 typedef base::Callback<void(const GURL& root,
59 const std::string& name, 63 const std::string& name,
60 base::File::Error result)> 64 base::File::Error result)>
61 OpenFileSystemCallback; 65 OpenFileSystemCallback;
62 typedef base::Callback<void(base::File::Error)> StatusCallback; 66 typedef base::Callback<void(base::File::Error)> StatusCallback;
63 typedef base::Callback<void(int64)> WriteCallback; 67 typedef base::Callback<void(int64)> WriteCallback;
64 typedef fileapi::FileSystemOperation::FileEntryList FileEntryList; 68 typedef fileapi::FileSystemOperation::FileEntryList FileEntryList;
65 69
66 CannedSyncableFileSystem(const GURL& origin, 70 CannedSyncableFileSystem(const GURL& origin,
71 leveldb::Env* env_override,
67 base::SingleThreadTaskRunner* io_task_runner, 72 base::SingleThreadTaskRunner* io_task_runner,
68 base::SingleThreadTaskRunner* file_task_runner); 73 base::SingleThreadTaskRunner* file_task_runner);
69 virtual ~CannedSyncableFileSystem(); 74 virtual ~CannedSyncableFileSystem();
70 75
71 // SetUp must be called before using this instance. 76 // SetUp must be called before using this instance.
72 void SetUp(); 77 void SetUp();
73 78
74 // TearDown must be called before destructing this instance. 79 // TearDown must be called before destructing this instance.
75 void TearDown(); 80 void TearDown();
76 81
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 const std::string service_name_; 223 const std::string service_name_;
219 224
220 scoped_refptr<quota::QuotaManager> quota_manager_; 225 scoped_refptr<quota::QuotaManager> quota_manager_;
221 scoped_refptr<fileapi::FileSystemContext> file_system_context_; 226 scoped_refptr<fileapi::FileSystemContext> file_system_context_;
222 const GURL origin_; 227 const GURL origin_;
223 const fileapi::FileSystemType type_; 228 const fileapi::FileSystemType type_;
224 GURL root_url_; 229 GURL root_url_;
225 base::File::Error result_; 230 base::File::Error result_;
226 sync_file_system::SyncStatusCode sync_status_; 231 sync_file_system::SyncStatusCode sync_status_;
227 232
233 leveldb::Env* env_override_;
228 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 234 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
229 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 235 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
230 236
231 // Boolean flags mainly for helping debug. 237 // Boolean flags mainly for helping debug.
232 bool is_filesystem_set_up_; 238 bool is_filesystem_set_up_;
233 bool is_filesystem_opened_; // Should be accessed only on the IO thread. 239 bool is_filesystem_opened_; // Should be accessed only on the IO thread.
234 240
235 scoped_refptr<ObserverList> sync_status_observers_; 241 scoped_refptr<ObserverList> sync_status_observers_;
236 242
237 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); 243 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem);
238 }; 244 };
239 245
240 } // namespace sync_file_system 246 } // namespace sync_file_system
241 247
242 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ 248 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698