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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
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 "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return true; | 141 return true; |
142 } | 142 } |
143 | 143 |
144 bool CreateFileSystemFile(const FilePath& file_path, | 144 bool CreateFileSystemFile(const FilePath& file_path, |
145 int64 file_size, | 145 int64 file_size, |
146 const std::string& origin_url, | 146 const std::string& origin_url, |
147 quota::StorageType storage_type) { | 147 quota::StorageType storage_type) { |
148 if (file_path.empty()) | 148 if (file_path.empty()) |
149 return false; | 149 return false; |
150 | 150 |
| 151 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); |
151 FileSystemFileUtil* file_util = file_system_context_-> | 152 FileSystemFileUtil* file_util = file_system_context_-> |
152 sandbox_provider()->GetFileUtil(); | 153 sandbox_provider()->GetFileUtil(type); |
153 | 154 |
154 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); | |
155 FileSystemURL url(GURL(origin_url), type, file_path); | 155 FileSystemURL url(GURL(origin_url), type, file_path); |
156 scoped_ptr<FileSystemOperationContext> context( | 156 scoped_ptr<FileSystemOperationContext> context( |
157 CreateFileSystemOperationContext()); | 157 CreateFileSystemOperationContext()); |
158 | 158 |
159 bool created = false; | 159 bool created = false; |
160 if (base::PLATFORM_FILE_OK != | 160 if (base::PLATFORM_FILE_OK != |
161 file_util->EnsureFileExists(context.get(), url, &created)) | 161 file_util->EnsureFileExists(context.get(), url, &created)) |
162 return false; | 162 return false; |
163 EXPECT_TRUE(created); | 163 EXPECT_TRUE(created); |
164 if (base::PLATFORM_FILE_OK != | 164 if (base::PLATFORM_FILE_OK != |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 GetOriginUsage(quota_client.get(), | 579 GetOriginUsage(quota_client.get(), |
580 "https://bar.com/", | 580 "https://bar.com/", |
581 kPersistent)); | 581 kPersistent)); |
582 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, | 582 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, |
583 GetOriginUsage(quota_client.get(), | 583 GetOriginUsage(quota_client.get(), |
584 "https://bar.com/", | 584 "https://bar.com/", |
585 kTemporary)); | 585 kTemporary)); |
586 } | 586 } |
587 | 587 |
588 } // namespace fileapi | 588 } // namespace fileapi |
OLD | NEW |