OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "webkit/fileapi/file_system_test_helper.h" | 5 #include "webkit/fileapi/file_system_test_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "webkit/fileapi/file_system_context.h" | 11 #include "webkit/fileapi/file_system_context.h" |
12 #include "webkit/fileapi/file_system_operation.h" | 12 #include "webkit/fileapi/file_system_operation.h" |
13 #include "webkit/fileapi/file_system_operation_context.h" | 13 #include "webkit/fileapi/file_system_operation_context.h" |
14 #include "webkit/fileapi/file_system_usage_cache.h" | 14 #include "webkit/fileapi/file_system_usage_cache.h" |
15 #include "webkit/fileapi/file_system_util.h" | 15 #include "webkit/fileapi/file_system_util.h" |
16 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 16 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
17 #include "webkit/quota/special_storage_policy.h" | 17 #include "webkit/quota/mock_special_storage_policy.h" |
18 | 18 |
19 namespace fileapi { | 19 namespace fileapi { |
20 namespace { | |
21 | |
22 class TestSpecialStoragePolicy : public quota::SpecialStoragePolicy { | |
23 public: | |
24 explicit TestSpecialStoragePolicy(bool unlimited_quota) | |
25 : unlimited_quota_(unlimited_quota) {} | |
26 | |
27 virtual bool IsStorageProtected(const GURL& origin) { | |
28 return false; | |
29 } | |
30 | |
31 virtual bool IsStorageUnlimited(const GURL& origin) { | |
32 return unlimited_quota_; | |
michaeln
2011/08/12 18:53:52
same question here, in some cases the test logic i
marja
2011/08/16 10:54:25
Done.
I thought it's FileSystemTestOriginHelper i
| |
33 } | |
34 | |
35 virtual bool IsFileHandler(const std::string& extension_id) { | |
marja
2011/08/16 10:54:25
And this was never called in unit_tests or test_sh
| |
36 return true; | |
37 } | |
38 | |
39 private: | |
40 bool unlimited_quota_; | |
41 }; | |
42 | |
43 } // anonymous namespace | |
44 | 20 |
45 FileSystemTestOriginHelper::FileSystemTestOriginHelper( | 21 FileSystemTestOriginHelper::FileSystemTestOriginHelper( |
46 const GURL& origin, FileSystemType type) | 22 const GURL& origin, FileSystemType type) |
47 : origin_(origin), type_(type), file_util_(NULL) { | 23 : origin_(origin), type_(type), file_util_(NULL) { |
48 } | 24 } |
49 | 25 |
50 FileSystemTestOriginHelper::FileSystemTestOriginHelper() | 26 FileSystemTestOriginHelper::FileSystemTestOriginHelper() |
51 : origin_(GURL("http://foo.com")), | 27 : origin_(GURL("http://foo.com")), |
52 type_(kFileSystemTypeTemporary), | 28 type_(kFileSystemTypeTemporary), |
53 file_util_(NULL) { | 29 file_util_(NULL) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 const FilePath& base_dir, | 65 const FilePath& base_dir, |
90 bool incognito_mode, | 66 bool incognito_mode, |
91 bool unlimited_quota, | 67 bool unlimited_quota, |
92 quota::QuotaManagerProxy* quota_manager_proxy, | 68 quota::QuotaManagerProxy* quota_manager_proxy, |
93 FileSystemFileUtil* file_util) { | 69 FileSystemFileUtil* file_util) { |
94 file_util_ = file_util; | 70 file_util_ = file_util; |
95 DCHECK(file_util_); | 71 DCHECK(file_util_); |
96 file_system_context_ = new FileSystemContext( | 72 file_system_context_ = new FileSystemContext( |
97 base::MessageLoopProxy::CreateForCurrentThread(), | 73 base::MessageLoopProxy::CreateForCurrentThread(), |
98 base::MessageLoopProxy::CreateForCurrentThread(), | 74 base::MessageLoopProxy::CreateForCurrentThread(), |
99 new TestSpecialStoragePolicy(unlimited_quota), | 75 new quota::MockSpecialStoragePolicy, |
100 quota_manager_proxy, | 76 quota_manager_proxy, |
101 base_dir, | 77 base_dir, |
102 incognito_mode, | 78 incognito_mode, |
103 true /* allow_file_access_from_files */, | 79 true /* allow_file_access_from_files */, |
104 unlimited_quota, | 80 unlimited_quota, |
105 NULL); | 81 NULL); |
106 | 82 |
107 DCHECK(file_system_context_->path_manager()); | 83 DCHECK(file_system_context_->path_manager()); |
108 DCHECK(file_system_context_->path_manager()->sandbox_provider()); | 84 DCHECK(file_system_context_->path_manager()->sandbox_provider()); |
109 | 85 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 void FileSystemTestOriginHelper::InitializeOperationContext( | 178 void FileSystemTestOriginHelper::InitializeOperationContext( |
203 FileSystemOperationContext* context) { | 179 FileSystemOperationContext* context) { |
204 DCHECK(context); | 180 DCHECK(context); |
205 context->set_src_origin_url(origin_); | 181 context->set_src_origin_url(origin_); |
206 context->set_src_type(type_); | 182 context->set_src_type(type_); |
207 context->set_dest_origin_url(origin_); | 183 context->set_dest_origin_url(origin_); |
208 context->set_dest_type(type_); | 184 context->set_dest_type(type_); |
209 } | 185 } |
210 | 186 |
211 } // namespace fileapi | 187 } // namespace fileapi |
OLD | NEW |