Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: webkit/fileapi/local_file_system_quota_unittest.cc

Issue 11639037: Accumulate FileSystemUsageCache updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skip update task for invalid usage cache Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/fileapi/obfuscated_file_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 FilePath PlatformPath(const FilePath& virtual_path) { 81 FilePath PlatformPath(const FilePath& virtual_path) {
82 return test_helper_.GetLocalPath(virtual_path); 82 return test_helper_.GetLocalPath(virtual_path);
83 } 83 }
84 84
85 int64 ActualFileSize() { 85 int64 ActualFileSize() {
86 return test_helper_.ComputeCurrentOriginUsage() - 86 return test_helper_.ComputeCurrentOriginUsage() -
87 test_helper_.ComputeCurrentDirectoryDatabaseUsage(); 87 test_helper_.ComputeCurrentDirectoryDatabaseUsage();
88 } 88 }
89 89
90 int64 SizeByQuotaUtil() { 90 int64 SizeByQuotaUtil() {
91 MessageLoop::current()->RunUntilIdle();
91 return test_helper_.GetCachedOriginUsage(); 92 return test_helper_.GetCachedOriginUsage();
92 } 93 }
93 94
94 void GetUsageAndQuotaFromQuotaManager() { 95 void GetUsageAndQuotaFromQuotaManager() {
95 quota_manager_->GetUsageAndQuota( 96 quota_manager_->GetUsageAndQuota(
96 test_helper_.origin(), test_helper_.storage_type(), 97 test_helper_.origin(), test_helper_.storage_type(),
97 base::Bind(&LocalFileSystemQuotaTest::OnGetUsageAndQuota, 98 base::Bind(&LocalFileSystemQuotaTest::OnGetUsageAndQuota,
98 weak_factory_.GetWeakPtr())); 99 weak_factory_.GetWeakPtr()));
99 MessageLoop::current()->RunUntilIdle(); 100 MessageLoop::current()->RunUntilIdle();
100 } 101 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 341
341 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualFileSize()); 342 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualFileSize());
342 EXPECT_EQ(expected_usage, SizeByQuotaUtil()); 343 EXPECT_EQ(expected_usage, SizeByQuotaUtil());
343 GetUsageAndQuotaFromQuotaManager(); 344 GetUsageAndQuotaFromQuotaManager();
344 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); 345 EXPECT_EQ(quota::kQuotaStatusOk, quota_status());
345 EXPECT_EQ(expected_usage, usage()); 346 EXPECT_EQ(expected_usage, usage());
346 ASSERT_LT(expected_usage, quota()); 347 ASSERT_LT(expected_usage, quota());
347 } 348 }
348 349
349 } // namespace fileapi 350 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/obfuscated_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698