| 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; | |
| 28 class FileSystemContext; | 27 class FileSystemContext; |
| 29 class FileSystemFileUtil; | 28 class FileSystemFileUtil; |
| 30 class FileSystemOperation; | 29 class FileSystemOperation; |
| 31 class FileSystemOperationContext; | 30 class FileSystemOperationContext; |
| 32 | 31 |
| 33 // Filesystem test helper class that encapsulates test environment for | 32 // Filesystem test helper class that encapsulates test environment for |
| 34 // a given {origin, type} pair. | 33 // a given {origin, type} pair. |
| 35 class FileSystemTestOriginHelper { | 34 class FileSystemTestOriginHelper { |
| 36 public: | 35 public: |
| 37 FileSystemTestOriginHelper(const GURL& origin, FileSystemType type); | 36 FileSystemTestOriginHelper(const GURL& origin, FileSystemType type); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 FilePath GetLocalPathFromASCII(const std::string& path); | 55 FilePath GetLocalPathFromASCII(const std::string& path); |
| 57 GURL GetURLForPath(const FilePath& path) const; | 56 GURL GetURLForPath(const FilePath& path) const; |
| 58 FilePath GetUsageCachePath() const; | 57 FilePath GetUsageCachePath() const; |
| 59 | 58 |
| 60 int64 GetCachedOriginUsage() const; | 59 int64 GetCachedOriginUsage() const; |
| 61 bool RevokeUsageCache() const; | 60 bool RevokeUsageCache() const; |
| 62 | 61 |
| 63 // This doesn't work with OFSFU. | 62 // This doesn't work with OFSFU. |
| 64 int64 ComputeCurrentOriginUsage() const; | 63 int64 ComputeCurrentOriginUsage() const; |
| 65 | 64 |
| 66 FileSystemOperation* NewOperation( | 65 FileSystemOperation* NewOperation(); |
| 67 FileSystemCallbackDispatcher* callback_dispatcher); | |
| 68 FileSystemOperationContext* NewOperationContext(); | 66 FileSystemOperationContext* NewOperationContext(); |
| 69 | 67 |
| 70 FileSystemContext* file_system_context() const { | 68 FileSystemContext* file_system_context() const { |
| 71 return file_system_context_.get(); | 69 return file_system_context_.get(); |
| 72 } | 70 } |
| 73 | 71 |
| 74 const GURL& origin() const { return origin_; } | 72 const GURL& origin() const { return origin_; } |
| 75 FileSystemType type() const { return type_; } | 73 FileSystemType type() const { return type_; } |
| 76 quota::StorageType storage_type() const { | 74 quota::StorageType storage_type() const { |
| 77 return FileSystemTypeToQuotaStorageType(type_); | 75 return FileSystemTypeToQuotaStorageType(type_); |
| 78 } | 76 } |
| 79 FileSystemFileUtil* file_util() { return file_util_; } | 77 FileSystemFileUtil* file_util() { return file_util_; } |
| 80 | 78 |
| 81 private: | 79 private: |
| 82 void InitializeOperationContext(FileSystemOperationContext* context); | 80 void InitializeOperationContext(FileSystemOperationContext* context); |
| 83 | 81 |
| 84 scoped_refptr<FileSystemContext> file_system_context_; | 82 scoped_refptr<FileSystemContext> file_system_context_; |
| 85 const GURL origin_; | 83 const GURL origin_; |
| 86 const FileSystemType type_; | 84 const FileSystemType type_; |
| 87 FileSystemFileUtil* file_util_; | 85 FileSystemFileUtil* file_util_; |
| 88 int64 initial_usage_size_; | 86 int64 initial_usage_size_; |
| 89 }; | 87 }; |
| 90 | 88 |
| 91 } // namespace fileapi | 89 } // namespace fileapi |
| 92 | 90 |
| 93 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ | 91 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_TEST_HELPER_H_ |
| OLD | NEW |