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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 int64 ComputeTotalFileSize() { | 208 int64 ComputeTotalFileSize() { |
209 return test_helper_.ComputeCurrentOriginUsage() - | 209 return test_helper_.ComputeCurrentOriginUsage() - |
210 test_helper_.ComputeCurrentDirectoryDatabaseUsage(); | 210 test_helper_.ComputeCurrentDirectoryDatabaseUsage(); |
211 } | 211 } |
212 | 212 |
213 void GetUsageFromQuotaManager() { | 213 void GetUsageFromQuotaManager() { |
214 quota_manager_->GetUsageAndQuota( | 214 quota_manager_->GetUsageAndQuota( |
215 origin(), test_helper_.storage_type(), | 215 origin(), test_helper_.storage_type(), |
216 base::Bind(&ObfuscatedFileUtilTest::OnGetUsage, | 216 base::Bind(&ObfuscatedFileUtilTest::OnGetUsage, |
217 weak_factory_.GetWeakPtr())); | 217 weak_factory_.GetWeakPtr())); |
218 MessageLoop::current()->RunAllPending(); | 218 MessageLoop::current()->RunUntilIdle(); |
219 EXPECT_EQ(quota::kQuotaStatusOk, quota_status_); | 219 EXPECT_EQ(quota::kQuotaStatusOk, quota_status_); |
220 } | 220 } |
221 | 221 |
222 void RevokeUsageCache() { | 222 void RevokeUsageCache() { |
223 quota_manager_->ResetUsageTracker(test_helper_.storage_type()); | 223 quota_manager_->ResetUsageTracker(test_helper_.storage_type()); |
224 file_util::Delete(test_helper_.GetUsageCachePath(), false); | 224 file_util::Delete(test_helper_.GetUsageCachePath(), false); |
225 } | 225 } |
226 | 226 |
227 int64 SizeByQuotaUtil() { | 227 int64 SizeByQuotaUtil() { |
228 return test_helper_.GetCachedOriginUsage(); | 228 return test_helper_.GetCachedOriginUsage(); |
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 ASSERT_EQ(base::PLATFORM_FILE_OK, | 2225 ASSERT_EQ(base::PLATFORM_FILE_OK, |
2226 ofu()->CreateOrOpen( | 2226 ofu()->CreateOrOpen( |
2227 AllowUsageIncrease(-length)->context(), file, | 2227 AllowUsageIncrease(-length)->context(), file, |
2228 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, | 2228 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, |
2229 &file_handle, &created)); | 2229 &file_handle, &created)); |
2230 ASSERT_EQ(0, ComputeTotalFileSize()); | 2230 ASSERT_EQ(0, ComputeTotalFileSize()); |
2231 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); | 2231 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); |
2232 } | 2232 } |
2233 | 2233 |
2234 } // namespace fileapi | 2234 } // namespace fileapi |
OLD | NEW |