| 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 WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "webkit/fileapi/file_system_types.h" | 15 #include "webkit/fileapi/file_system_types.h" |
| 16 #include "webkit/fileapi/file_system_util.h" | 16 #include "webkit/fileapi/file_system_util.h" |
| 17 #include "webkit/quota/quota_types.h" | 17 #include "webkit/quota/quota_types.h" |
| 18 | 18 |
| 19 namespace quota { | 19 namespace quota { |
| 20 class QuotaManagerProxy; | 20 class QuotaManagerProxy; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class FilePath; | 23 class FilePath; |
| 24 | 24 |
| 25 namespace fileapi { | 25 namespace fileapi { |
| 26 | 26 |
| 27 class FileSystemCallbackDispatcher; |
| 27 class FileSystemContext; | 28 class FileSystemContext; |
| 28 class FileSystemFileUtil; | 29 class FileSystemFileUtil; |
| 29 class FileSystemOperation; | 30 class FileSystemOperation; |
| 30 class FileSystemOperationContext; | 31 class FileSystemOperationContext; |
| 31 | 32 |
| 32 // Filesystem test helper class that encapsulates test environment for | 33 // Filesystem test helper class that encapsulates test environment for |
| 33 // a given {origin, type} pair. | 34 // a given {origin, type} pair. |
| 34 class FileSystemTestOriginHelper { | 35 class FileSystemTestOriginHelper { |
| 35 public: | 36 public: |
| 36 FileSystemTestOriginHelper(const GURL& origin, FileSystemType type); | 37 FileSystemTestOriginHelper(const GURL& origin, FileSystemType type); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 55 FilePath GetLocalPathFromASCII(const std::string& path); | 56 FilePath GetLocalPathFromASCII(const std::string& path); |
| 56 GURL GetURLForPath(const FilePath& path) const; | 57 GURL GetURLForPath(const FilePath& path) const; |
| 57 FilePath GetUsageCachePath() const; | 58 FilePath GetUsageCachePath() const; |
| 58 | 59 |
| 59 int64 GetCachedOriginUsage() const; | 60 int64 GetCachedOriginUsage() const; |
| 60 bool RevokeUsageCache() const; | 61 bool RevokeUsageCache() const; |
| 61 | 62 |
| 62 // This doesn't work with OFSFU. | 63 // This doesn't work with OFSFU. |
| 63 int64 ComputeCurrentOriginUsage() const; | 64 int64 ComputeCurrentOriginUsage() const; |
| 64 | 65 |
| 65 FileSystemOperation* NewOperation(); | 66 FileSystemOperation* NewOperation( |
| 67 FileSystemCallbackDispatcher* callback_dispatcher); |
| 66 FileSystemOperationContext* NewOperationContext(); | 68 FileSystemOperationContext* NewOperationContext(); |
| 67 | 69 |
| 68 FileSystemContext* file_system_context() const { | 70 FileSystemContext* file_system_context() const { |
| 69 return file_system_context_.get(); | 71 return file_system_context_.get(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 const GURL& origin() const { return origin_; } | 74 const GURL& origin() const { return origin_; } |
| 73 FileSystemType type() const { return type_; } | 75 FileSystemType type() const { return type_; } |
| 74 quota::StorageType storage_type() const { | 76 quota::StorageType storage_type() const { |
| 75 return FileSystemTypeToQuotaStorageType(type_); | 77 return FileSystemTypeToQuotaStorageType(type_); |
| 76 } | 78 } |
| 77 FileSystemFileUtil* file_util() { return file_util_; } | 79 FileSystemFileUtil* file_util() { return file_util_; } |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 void InitializeOperationContext(FileSystemOperationContext* context); | 82 void InitializeOperationContext(FileSystemOperationContext* context); |
| 81 | 83 |
| 82 scoped_refptr<FileSystemContext> file_system_context_; | 84 scoped_refptr<FileSystemContext> file_system_context_; |
| 83 const GURL origin_; | 85 const GURL origin_; |
| 84 const FileSystemType type_; | 86 const FileSystemType type_; |
| 85 FileSystemFileUtil* file_util_; | 87 FileSystemFileUtil* file_util_; |
| 86 int64 initial_usage_size_; | 88 int64 initial_usage_size_; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace fileapi | 91 } // namespace fileapi |
| 90 | 92 |
| 91 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ | 93 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ |
| OLD | NEW |