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 // This test checks the entire behavior of FileSystem usage and quota, such as: | 5 // This test checks the entire behavior of FileSystem usage and quota, such as: |
6 // 1) the actual size of files on disk, | 6 // 1) the actual size of files on disk, |
7 // 2) the described size in .usage, and | 7 // 2) the described size in .usage, and |
8 // 3) the result of QuotaManager::GetUsageAndQuota. | 8 // 3) the result of QuotaManager::GetUsageAndQuota. |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 223 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
224 EXPECT_EQ(all_file_size, usage()); | 224 EXPECT_EQ(all_file_size, usage()); |
225 ASSERT_LT(all_file_size, quota()); | 225 ASSERT_LT(all_file_size, quota()); |
226 | 226 |
227 operation()->Move(URLForPath(src_dir_path), URLForPath(dest_dir_path), | 227 operation()->Move(URLForPath(src_dir_path), URLForPath(dest_dir_path), |
228 RecordStatusCallback()); | 228 RecordStatusCallback()); |
229 MessageLoop::current()->RunAllPending(); | 229 MessageLoop::current()->RunAllPending(); |
230 | 230 |
231 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 231 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
232 EXPECT_TRUE(VirtualDirectoryExists(dest_dir_path.Append( | 232 EXPECT_TRUE(VirtualDirectoryExists(dest_dir_path.Append( |
233 child_dir_path_.BaseName()))); | 233 VirtualPath::BaseName(child_dir_path_)))); |
234 EXPECT_TRUE(VirtualFileExists(dest_dir_path.Append( | 234 EXPECT_TRUE(VirtualFileExists(dest_dir_path.Append( |
235 child_dir_path_.BaseName()).Append( | 235 VirtualPath::BaseName(child_dir_path_)).Append( |
236 grandchild_file1_path_.BaseName()))); | 236 VirtualPath::BaseName(grandchild_file1_path_)))); |
237 | 237 |
238 EXPECT_EQ(all_file_size, ActualSize()); | 238 EXPECT_EQ(all_file_size, ActualSize()); |
239 EXPECT_EQ(all_file_size, SizeInUsageFile()); | 239 EXPECT_EQ(all_file_size, SizeInUsageFile()); |
240 GetUsageAndQuotaFromQuotaManager(); | 240 GetUsageAndQuotaFromQuotaManager(); |
241 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 241 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
242 EXPECT_EQ(all_file_size, usage()); | 242 EXPECT_EQ(all_file_size, usage()); |
243 ASSERT_LT(all_file_size, quota()); | 243 ASSERT_LT(all_file_size, quota()); |
244 } | 244 } |
245 | 245 |
246 TEST_F(FileSystemQuotaTest, TestCopySuccessSrcDirRecursive) { | 246 TEST_F(FileSystemQuotaTest, TestCopySuccessSrcDirRecursive) { |
(...skipping 24 matching lines...) Expand all Loading... |
271 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 271 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
272 EXPECT_EQ(all_file_size, usage()); | 272 EXPECT_EQ(all_file_size, usage()); |
273 ASSERT_LT(all_file_size, quota()); | 273 ASSERT_LT(all_file_size, quota()); |
274 | 274 |
275 operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_dir1_path), | 275 operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_dir1_path), |
276 RecordStatusCallback()); | 276 RecordStatusCallback()); |
277 MessageLoop::current()->RunAllPending(); | 277 MessageLoop::current()->RunAllPending(); |
278 | 278 |
279 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 279 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
280 EXPECT_TRUE(VirtualDirectoryExists(src_dir_path.Append( | 280 EXPECT_TRUE(VirtualDirectoryExists(src_dir_path.Append( |
281 child_dir_path_.BaseName()))); | 281 VirtualPath::BaseName(child_dir_path_)))); |
282 EXPECT_TRUE(VirtualFileExists(src_dir_path.Append( | 282 EXPECT_TRUE(VirtualFileExists(src_dir_path.Append( |
283 child_dir_path_.BaseName()).Append( | 283 VirtualPath::BaseName(child_dir_path_)).Append( |
284 grandchild_file1_path_.BaseName()))); | 284 VirtualPath::BaseName(grandchild_file1_path_)))); |
285 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 285 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
286 EXPECT_TRUE(VirtualDirectoryExists(dest_dir1_path.Append( | 286 EXPECT_TRUE(VirtualDirectoryExists(dest_dir1_path.Append( |
287 child_dir_path_.BaseName()))); | 287 VirtualPath::BaseName(child_dir_path_)))); |
288 EXPECT_TRUE(VirtualFileExists(dest_dir1_path.Append( | 288 EXPECT_TRUE(VirtualFileExists(dest_dir1_path.Append( |
289 child_dir_path_.BaseName()).Append( | 289 VirtualPath::BaseName(child_dir_path_)).Append( |
290 grandchild_file1_path_.BaseName()))); | 290 VirtualPath::BaseName(grandchild_file1_path_)))); |
291 | 291 |
292 EXPECT_EQ(2 * all_file_size, ActualSize()); | 292 EXPECT_EQ(2 * all_file_size, ActualSize()); |
293 EXPECT_EQ(2 * all_file_size, SizeInUsageFile()); | 293 EXPECT_EQ(2 * all_file_size, SizeInUsageFile()); |
294 GetUsageAndQuotaFromQuotaManager(); | 294 GetUsageAndQuotaFromQuotaManager(); |
295 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 295 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
296 EXPECT_EQ(2 * all_file_size, usage()); | 296 EXPECT_EQ(2 * all_file_size, usage()); |
297 ASSERT_LT(2 * all_file_size, quota()); | 297 ASSERT_LT(2 * all_file_size, quota()); |
298 | 298 |
299 operation()->Copy(URLForPath(child_dir_path_), URLForPath(dest_dir2_path), | 299 operation()->Copy(URLForPath(child_dir_path_), URLForPath(dest_dir2_path), |
300 RecordStatusCallback()); | 300 RecordStatusCallback()); |
301 MessageLoop::current()->RunAllPending(); | 301 MessageLoop::current()->RunAllPending(); |
302 | 302 |
303 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 303 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
304 | 304 |
305 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualSize()); | 305 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualSize()); |
306 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, SizeInUsageFile()); | 306 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, SizeInUsageFile()); |
307 GetUsageAndQuotaFromQuotaManager(); | 307 GetUsageAndQuotaFromQuotaManager(); |
308 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 308 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
309 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, usage()); | 309 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, usage()); |
310 ASSERT_LT(2 * child_file_size + 3 * grandchild_file_size, quota()); | 310 ASSERT_LT(2 * child_file_size + 3 * grandchild_file_size, quota()); |
311 } | 311 } |
312 | 312 |
313 } // namespace fileapi | 313 } // namespace fileapi |
OLD | NEW |