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

Unified Diff: webkit/fileapi/syncable/syncable_file_system_unittest.cc

Issue 11266031: Add Quota related method to CannedSyncableFileSystem for testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/syncable/canned_syncable_file_system.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/syncable/syncable_file_system_unittest.cc
diff --git a/webkit/fileapi/syncable/syncable_file_system_unittest.cc b/webkit/fileapi/syncable/syncable_file_system_unittest.cc
index 1850b0575ef3064eea1dffc489587b83699fac72..2bdf834c2fef8a5a482c26b883f4048e1cdc7f6d 100644
--- a/webkit/fileapi/syncable/syncable_file_system_unittest.cc
+++ b/webkit/fileapi/syncable/syncable_file_system_unittest.cc
@@ -26,9 +26,6 @@ class SyncableFileSystemTest : public testing::Test {
SyncableFileSystemTest()
: file_system_(GURL("http://example.com/"), "test",
base::MessageLoopProxy::current()),
- quota_status_(quota::kQuotaStatusUnknown),
- usage_(-1),
- quota_(-1),
weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
void SetUp() {
@@ -53,28 +50,7 @@ class SyncableFileSystemTest : public testing::Test {
RevokeSyncableFileSystem("test");
}
- void DidGetUsageAndQuota(QuotaStatusCode status, int64 usage, int64 quota) {
- quota_status_ = status;
- usage_ = usage;
- quota_ = quota;
- }
-
protected:
- void GetUsageAndQuota(int64* usage, int64* quota) {
- quota_status_ = quota::kQuotaStatusUnknown;
- file_system_.quota_manager()->GetUsageAndQuota(
- file_system_.origin(),
- file_system_.storage_type(),
- base::Bind(&SyncableFileSystemTest::DidGetUsageAndQuota,
- weak_factory_.GetWeakPtr()));
- MessageLoop::current()->RunAllPending();
- EXPECT_EQ(quota::kQuotaStatusOk, quota_status_);
- if (usage)
- *usage = usage_;
- if (quota)
- *quota = quota_;
- }
-
void VerifyAndClearChange(const FileSystemURL& url,
const FileChange& expected_change) {
SCOPED_TRACE(testing::Message() << url.DebugString() <<
@@ -109,9 +85,6 @@ class SyncableFileSystemTest : public testing::Test {
CannedSyncableFileSystem file_system_;
scoped_refptr<LocalFileSyncContext> sync_context_;
- QuotaStatusCode quota_status_;
- int64 usage_;
- int64 quota_;
base::WeakPtrFactory<SyncableFileSystemTest> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SyncableFileSystemTest);
@@ -134,7 +107,8 @@ TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) {
const int64 kQuota = 12345 * 1024;
QuotaManager::kSyncableStorageDefaultHostQuota = kQuota;
int64 usage, quota;
- GetUsageAndQuota(&usage, &quota);
+ EXPECT_EQ(quota::kQuotaStatusOk,
+ file_system_.GetUsageAndQuota(&usage, &quota));
// Returned quota must be what we overrode. Usage must be greater than 0
// as creating a file or directory consumes some space.
@@ -150,7 +124,8 @@ TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) {
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend));
int64 new_usage;
- GetUsageAndQuota(&new_usage, NULL);
+ EXPECT_EQ(quota::kQuotaStatusOk,
+ file_system_.GetUsageAndQuota(&new_usage, &quota));
EXPECT_EQ(kFileSizeToExtend, new_usage - usage);
// Shrink the quota to the current usage, try to extend the file further
@@ -160,7 +135,8 @@ TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) {
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend + 1));
usage = new_usage;
- GetUsageAndQuota(&new_usage, NULL);
+ EXPECT_EQ(quota::kQuotaStatusOk,
+ file_system_.GetUsageAndQuota(&new_usage, &quota));
EXPECT_EQ(usage, new_usage);
// Deletes the file system.
@@ -168,7 +144,8 @@ TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) {
file_system_.DeleteFileSystem());
// Now the usage must be zero.
- GetUsageAndQuota(&usage, NULL);
+ EXPECT_EQ(quota::kQuotaStatusOk,
+ file_system_.GetUsageAndQuota(&usage, &quota));
EXPECT_EQ(0, usage);
// Restore the system default quota.
« no previous file with comments | « webkit/fileapi/syncable/canned_syncable_file_system.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698