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

Side by Side Diff: content/public/test/sandbox_file_system_test_helper.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ 5 #ifndef CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
6 #define CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ 6 #define CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 #include "webkit/browser/fileapi/file_system_url.h" 13 #include "storage/browser/fileapi/file_system_url.h"
14 #include "webkit/browser/fileapi/file_system_usage_cache.h" 14 #include "storage/browser/fileapi/file_system_usage_cache.h"
15 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" 15 #include "storage/browser/fileapi/task_runner_bound_observer_list.h"
16 #include "webkit/common/fileapi/file_system_types.h" 16 #include "storage/common/fileapi/file_system_types.h"
17 #include "webkit/common/fileapi/file_system_util.h" 17 #include "storage/common/fileapi/file_system_util.h"
18 #include "webkit/common/quota/quota_types.h" 18 #include "storage/common/quota/quota_types.h"
19 19
20 namespace base { 20 namespace base {
21 class FilePath; 21 class FilePath;
22 } 22 }
23 23
24 namespace quota { 24 namespace quota {
25 class QuotaManagerProxy; 25 class QuotaManagerProxy;
26 } 26 }
27 27
28 namespace fileapi { 28 namespace storage {
29 class FileSystemContext; 29 class FileSystemContext;
30 class FileSystemFileUtil; 30 class FileSystemFileUtil;
31 class FileSystemOperationContext; 31 class FileSystemOperationContext;
32 class FileSystemOperationRunner; 32 class FileSystemOperationRunner;
33 } 33 }
34 34
35 namespace content { 35 namespace content {
36 36
37 // Filesystem test helper class that encapsulates test environment for 37 // Filesystem test helper class that encapsulates test environment for
38 // a given {origin, type} pair. This helper only works for sandboxed 38 // a given {origin, type} pair. This helper only works for sandboxed
39 // file systems (Temporary or Persistent). 39 // file systems (Temporary or Persistent).
40 class SandboxFileSystemTestHelper { 40 class SandboxFileSystemTestHelper {
41 public: 41 public:
42 SandboxFileSystemTestHelper(const GURL& origin, fileapi::FileSystemType type); 42 SandboxFileSystemTestHelper(const GURL& origin, storage::FileSystemType type);
43 SandboxFileSystemTestHelper(); 43 SandboxFileSystemTestHelper();
44 ~SandboxFileSystemTestHelper(); 44 ~SandboxFileSystemTestHelper();
45 45
46 void SetUp(const base::FilePath& base_dir); 46 void SetUp(const base::FilePath& base_dir);
47 // If you want to use more than one SandboxFileSystemTestHelper in 47 // If you want to use more than one SandboxFileSystemTestHelper in
48 // a single base directory, they have to share a context, so that they don't 48 // a single base directory, they have to share a context, so that they don't
49 // have multiple databases fighting over the lock to the origin directory 49 // have multiple databases fighting over the lock to the origin directory
50 // [deep down inside ObfuscatedFileUtil]. 50 // [deep down inside ObfuscatedFileUtil].
51 void SetUp(fileapi::FileSystemContext* file_system_context); 51 void SetUp(storage::FileSystemContext* file_system_context);
52 void SetUp(const base::FilePath& base_dir, 52 void SetUp(const base::FilePath& base_dir,
53 quota::QuotaManagerProxy* quota_manager_proxy); 53 quota::QuotaManagerProxy* quota_manager_proxy);
54 void TearDown(); 54 void TearDown();
55 55
56 base::FilePath GetOriginRootPath(); 56 base::FilePath GetOriginRootPath();
57 base::FilePath GetLocalPath(const base::FilePath& path); 57 base::FilePath GetLocalPath(const base::FilePath& path);
58 base::FilePath GetLocalPathFromASCII(const std::string& path); 58 base::FilePath GetLocalPathFromASCII(const std::string& path);
59 59
60 // Returns empty path if filesystem type is neither temporary nor persistent. 60 // Returns empty path if filesystem type is neither temporary nor persistent.
61 base::FilePath GetUsageCachePath() const; 61 base::FilePath GetUsageCachePath() const;
62 62
63 fileapi::FileSystemURL CreateURL(const base::FilePath& path) const; 63 storage::FileSystemURL CreateURL(const base::FilePath& path) const;
64 fileapi::FileSystemURL CreateURLFromUTF8(const std::string& utf8) const { 64 storage::FileSystemURL CreateURLFromUTF8(const std::string& utf8) const {
65 return CreateURL(base::FilePath::FromUTF8Unsafe(utf8)); 65 return CreateURL(base::FilePath::FromUTF8Unsafe(utf8));
66 } 66 }
67 67
68 // This returns cached usage size returned by QuotaUtil. 68 // This returns cached usage size returned by QuotaUtil.
69 int64 GetCachedOriginUsage() const; 69 int64 GetCachedOriginUsage() const;
70 70
71 // This doesn't work with OFSFU. 71 // This doesn't work with OFSFU.
72 int64 ComputeCurrentOriginUsage(); 72 int64 ComputeCurrentOriginUsage();
73 73
74 int64 ComputeCurrentDirectoryDatabaseUsage(); 74 int64 ComputeCurrentDirectoryDatabaseUsage();
75 75
76 fileapi::FileSystemOperationRunner* operation_runner(); 76 storage::FileSystemOperationRunner* operation_runner();
77 fileapi::FileSystemOperationContext* NewOperationContext(); 77 storage::FileSystemOperationContext* NewOperationContext();
78 78
79 void AddFileChangeObserver(fileapi::FileChangeObserver* observer); 79 void AddFileChangeObserver(storage::FileChangeObserver* observer);
80 80
81 fileapi::FileSystemContext* file_system_context() const { 81 storage::FileSystemContext* file_system_context() const {
82 return file_system_context_.get(); 82 return file_system_context_.get();
83 } 83 }
84 84
85 const GURL& origin() const { return origin_; } 85 const GURL& origin() const { return origin_; }
86 fileapi::FileSystemType type() const { return type_; } 86 storage::FileSystemType type() const { return type_; }
87 quota::StorageType storage_type() const { 87 quota::StorageType storage_type() const {
88 return fileapi::FileSystemTypeToQuotaStorageType(type_); 88 return storage::FileSystemTypeToQuotaStorageType(type_);
89 } 89 }
90 fileapi::FileSystemFileUtil* file_util() const { return file_util_; } 90 storage::FileSystemFileUtil* file_util() const { return file_util_; }
91 fileapi::FileSystemUsageCache* usage_cache(); 91 storage::FileSystemUsageCache* usage_cache();
92 92
93 private: 93 private:
94 void SetUpFileSystem(); 94 void SetUpFileSystem();
95 95
96 scoped_refptr<fileapi::FileSystemContext> file_system_context_; 96 scoped_refptr<storage::FileSystemContext> file_system_context_;
97 97
98 const GURL origin_; 98 const GURL origin_;
99 const fileapi::FileSystemType type_; 99 const storage::FileSystemType type_;
100 fileapi::FileSystemFileUtil* file_util_; 100 storage::FileSystemFileUtil* file_util_;
101 }; 101 };
102 102
103 } // namespace content 103 } // namespace content
104 104
105 #endif // CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ 105 #endif // CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « content/public/test/mock_storage_client.cc ('k') | content/public/test/sandbox_file_system_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698