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" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 FileSystemTestOriginHelper::FileSystemTestOriginHelper() | 50 FileSystemTestOriginHelper::FileSystemTestOriginHelper() |
51 : origin_(GURL("http://foo.com")), | 51 : origin_(GURL("http://foo.com")), |
52 type_(kFileSystemTypeTemporary), | 52 type_(kFileSystemTypeTemporary), |
53 file_util_(NULL) { | 53 file_util_(NULL) { |
54 } | 54 } |
55 | 55 |
56 FileSystemTestOriginHelper::~FileSystemTestOriginHelper() { | 56 FileSystemTestOriginHelper::~FileSystemTestOriginHelper() { |
57 } | 57 } |
58 | 58 |
59 void FileSystemTestOriginHelper::SetUp( | 59 void FileSystemTestOriginHelper::SetUp( |
60 const FilePath& base_dir, FileSystemFileUtil* file_util) { | 60 const FilePath& base_dir, FileApiFileUtil* file_util) { |
61 SetUp(base_dir, false, false, NULL, file_util); | 61 SetUp(base_dir, false, false, NULL, file_util); |
62 } | 62 } |
63 | 63 |
64 void FileSystemTestOriginHelper::SetUp( | 64 void FileSystemTestOriginHelper::SetUp( |
65 FileSystemContext* file_system_context, | 65 FileSystemContext* file_system_context, FileApiFileUtil* file_util) { |
66 FileSystemFileUtil* file_util) { | |
67 DCHECK(file_system_context->path_manager()); | 66 DCHECK(file_system_context->path_manager()); |
68 DCHECK(file_system_context->path_manager()->sandbox_provider()); | 67 DCHECK(file_system_context->path_manager()->sandbox_provider()); |
69 | 68 |
70 file_util_ = file_util; | 69 file_util_ = file_util; |
71 file_system_context_ = file_system_context; | 70 file_system_context_ = file_system_context; |
72 if (!file_util_) | 71 if (!file_util_) |
73 file_util_ = file_system_context->path_manager()->sandbox_provider()-> | 72 file_util_ = file_system_context->path_manager()->sandbox_provider()-> |
74 GetFileSystemFileUtil(); | 73 GetFileUtil(); |
75 DCHECK(file_util_); | 74 DCHECK(file_util_); |
76 | 75 |
77 // Prepare the origin's root directory. | 76 // Prepare the origin's root directory. |
78 file_system_context_->path_manager()-> | 77 file_system_context_->path_manager()-> |
79 ValidateFileSystemRootAndGetPathOnFileThread( | 78 ValidateFileSystemRootAndGetPathOnFileThread( |
80 origin_, type_, FilePath(), true /* create */); | 79 origin_, type_, FilePath(), true /* create */); |
81 | 80 |
82 // Initialize the usage cache file. | 81 // Initialize the usage cache file. |
83 FilePath usage_cache_path = file_system_context_->path_manager() | 82 FilePath usage_cache_path = file_system_context_->path_manager() |
84 ->sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); | 83 ->sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); |
85 FileSystemUsageCache::UpdateUsage(usage_cache_path, 0); | 84 FileSystemUsageCache::UpdateUsage(usage_cache_path, 0); |
86 } | 85 } |
87 | 86 |
88 void FileSystemTestOriginHelper::SetUp( | 87 void FileSystemTestOriginHelper::SetUp( |
89 const FilePath& base_dir, | 88 const FilePath& base_dir, |
90 bool incognito_mode, | 89 bool incognito_mode, |
91 bool unlimited_quota, | 90 bool unlimited_quota, |
92 quota::QuotaManagerProxy* quota_manager_proxy, | 91 quota::QuotaManagerProxy* quota_manager_proxy, |
93 FileSystemFileUtil* file_util) { | 92 FileApiFileUtil* file_util) { |
94 file_util_ = file_util; | 93 file_util_ = file_util; |
95 DCHECK(file_util_); | 94 DCHECK(file_util_); |
96 file_system_context_ = new FileSystemContext( | 95 file_system_context_ = new FileSystemContext( |
97 base::MessageLoopProxy::current(), | 96 base::MessageLoopProxy::current(), |
98 base::MessageLoopProxy::current(), | 97 base::MessageLoopProxy::current(), |
99 new TestSpecialStoragePolicy(unlimited_quota), | 98 new TestSpecialStoragePolicy(unlimited_quota), |
100 quota_manager_proxy, | 99 quota_manager_proxy, |
101 base_dir, | 100 base_dir, |
102 incognito_mode, | 101 incognito_mode, |
103 true /* allow_file_access_from_files */, | 102 true /* allow_file_access_from_files */, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 void FileSystemTestOriginHelper::InitializeOperationContext( | 201 void FileSystemTestOriginHelper::InitializeOperationContext( |
203 FileSystemOperationContext* context) { | 202 FileSystemOperationContext* context) { |
204 DCHECK(context); | 203 DCHECK(context); |
205 context->set_src_origin_url(origin_); | 204 context->set_src_origin_url(origin_); |
206 context->set_src_type(type_); | 205 context->set_src_type(type_); |
207 context->set_dest_origin_url(origin_); | 206 context->set_dest_origin_url(origin_); |
208 context->set_dest_type(type_); | 207 context->set_dest_type(type_); |
209 } | 208 } |
210 | 209 |
211 } // namespace fileapi | 210 } // namespace fileapi |
OLD | NEW |