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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h

Issue 279213002: [fsp] Add support for closing files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _
7 7
8 #include <set>
9
8 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 10 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
9 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
10 12
11 namespace extensions { 13 namespace extensions {
12 class EventRouter; 14 class EventRouter;
13 } // namespace extensions 15 } // namespace extensions
14 16
15 namespace chromeos { 17 namespace chromeos {
16 namespace file_system_provider { 18 namespace file_system_provider {
17 19
18 class RequestManager; 20 class RequestManager;
19 21
20 // Fake provided file system implementation. Does not communicate with target 22 // Fake provided file system implementation. Does not communicate with target
21 // extensions. Used for unit tests. 23 // extensions. Used for unit tests.
22 class FakeProvidedFileSystem : public ProvidedFileSystemInterface { 24 class FakeProvidedFileSystem : public ProvidedFileSystemInterface {
23 public: 25 public:
24 explicit FakeProvidedFileSystem( 26 explicit FakeProvidedFileSystem(
25 const ProvidedFileSystemInfo& file_system_info); 27 const ProvidedFileSystemInfo& file_system_info);
26 virtual ~FakeProvidedFileSystem(); 28 virtual ~FakeProvidedFileSystem();
27 29
28 // ProvidedFileSystemInterface overrides. 30 // ProvidedFileSystemInterface overrides.
29 virtual void RequestUnmount( 31 virtual void RequestUnmount(
30 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 32 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
31 virtual void GetMetadata( 33 virtual void GetMetadata(
32 const base::FilePath& entry_path, 34 const base::FilePath& entry_path,
33 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) OVERRIDE; 35 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) OVERRIDE;
34 virtual void ReadDirectory( 36 virtual void ReadDirectory(
35 const base::FilePath& directory_path, 37 const base::FilePath& directory_path,
36 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE; 38 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE;
37 virtual void OpenFile( 39 virtual void OpenFile(const base::FilePath& file_path,
38 const base::FilePath& file_path, 40 OpenFileMode mode,
39 OpenFileMode mode, 41 bool create,
40 bool create, 42 const OpenFileCallback& callback) OVERRIDE;
43 virtual void CloseFile(
44 int file_handle,
41 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 45 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
42 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; 46 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE;
43 virtual RequestManager* GetRequestManager() OVERRIDE; 47 virtual RequestManager* GetRequestManager() OVERRIDE;
44 48
45 // Factory callback, to be used in Service::SetFileSystemFactory(). The 49 // Factory callback, to be used in Service::SetFileSystemFactory(). The
46 // |event_router| argument can be NULL. 50 // |event_router| argument can be NULL.
47 static ProvidedFileSystemInterface* Create( 51 static ProvidedFileSystemInterface* Create(
48 extensions::EventRouter* event_router, 52 extensions::EventRouter* event_router,
49 const ProvidedFileSystemInfo& file_system_info); 53 const ProvidedFileSystemInfo& file_system_info);
50 54
51 private: 55 private:
52 ProvidedFileSystemInfo file_system_info_; 56 ProvidedFileSystemInfo file_system_info_;
57 std::set<int> opened_files_;
58 int last_file_handle_;
53 59
54 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); 60 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem);
55 }; 61 };
56 62
57 } // namespace file_system_provider 63 } // namespace file_system_provider
58 } // namespace chromeos 64 } // namespace chromeos
59 65
60 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_ 66 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698