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

Side by Side Diff: content/browser/quota/quota_backend_impl_unittest.cc

Issue 638503002: Replacing the OVERRIDE with override and FINAL with final in content/browser/[download|… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "storage/browser/fileapi/quota/quota_backend_impl.h" 5 #include "storage/browser/fileapi/quota/quota_backend_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { 41 class MockQuotaManagerProxy : public storage::QuotaManagerProxy {
42 public: 42 public:
43 MockQuotaManagerProxy() 43 MockQuotaManagerProxy()
44 : QuotaManagerProxy(NULL, NULL), 44 : QuotaManagerProxy(NULL, NULL),
45 storage_modified_count_(0), 45 storage_modified_count_(0),
46 usage_(0), quota_(0) {} 46 usage_(0), quota_(0) {}
47 47
48 // We don't mock them. 48 // We don't mock them.
49 virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {} 49 virtual void NotifyOriginInUse(const GURL& origin) override {}
50 virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {} 50 virtual void NotifyOriginNoLongerInUse(const GURL& origin) override {}
51 virtual void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, 51 virtual void SetUsageCacheEnabled(storage::QuotaClient::ID client_id,
52 const GURL& origin, 52 const GURL& origin,
53 storage::StorageType type, 53 storage::StorageType type,
54 bool enabled) OVERRIDE {} 54 bool enabled) override {}
55 55
56 virtual void NotifyStorageModified(storage::QuotaClient::ID client_id, 56 virtual void NotifyStorageModified(storage::QuotaClient::ID client_id,
57 const GURL& origin, 57 const GURL& origin,
58 storage::StorageType type, 58 storage::StorageType type,
59 int64 delta) OVERRIDE { 59 int64 delta) override {
60 ++storage_modified_count_; 60 ++storage_modified_count_;
61 usage_ += delta; 61 usage_ += delta;
62 ASSERT_LE(usage_, quota_); 62 ASSERT_LE(usage_, quota_);
63 } 63 }
64 64
65 virtual void GetUsageAndQuota( 65 virtual void GetUsageAndQuota(
66 base::SequencedTaskRunner* original_task_runner, 66 base::SequencedTaskRunner* original_task_runner,
67 const GURL& origin, 67 const GURL& origin,
68 storage::StorageType type, 68 storage::StorageType type,
69 const GetUsageAndQuotaCallback& callback) OVERRIDE { 69 const GetUsageAndQuotaCallback& callback) override {
70 callback.Run(storage::kQuotaStatusOk, usage_, quota_); 70 callback.Run(storage::kQuotaStatusOk, usage_, quota_);
71 } 71 }
72 72
73 int storage_modified_count() { return storage_modified_count_; } 73 int storage_modified_count() { return storage_modified_count_; }
74 int64 usage() { return usage_; } 74 int64 usage() { return usage_; }
75 void set_usage(int64 usage) { usage_ = usage; } 75 void set_usage(int64 usage) { usage_ = usage; }
76 void set_quota(int64 quota) { quota_ = quota; } 76 void set_quota(int64 quota) { quota_ = quota; }
77 77
78 protected: 78 protected:
79 virtual ~MockQuotaManagerProxy() {} 79 virtual ~MockQuotaManagerProxy() {}
80 80
81 private: 81 private:
82 int storage_modified_count_; 82 int storage_modified_count_;
83 int64 usage_; 83 int64 usage_;
84 int64 quota_; 84 int64 quota_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(MockQuotaManagerProxy); 86 DISALLOW_COPY_AND_ASSIGN(MockQuotaManagerProxy);
87 }; 87 };
88 88
89 } // namespace 89 } // namespace
90 90
91 class QuotaBackendImplTest : public testing::Test { 91 class QuotaBackendImplTest : public testing::Test {
92 public: 92 public:
93 QuotaBackendImplTest() 93 QuotaBackendImplTest()
94 : file_system_usage_cache_(file_task_runner()), 94 : file_system_usage_cache_(file_task_runner()),
95 quota_manager_proxy_(new MockQuotaManagerProxy) {} 95 quota_manager_proxy_(new MockQuotaManagerProxy) {}
96 96
97 virtual void SetUp() OVERRIDE { 97 virtual void SetUp() override {
98 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 98 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
99 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); 99 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default()));
100 file_util_.reset(ObfuscatedFileUtil::CreateForTesting( 100 file_util_.reset(ObfuscatedFileUtil::CreateForTesting(
101 NULL, data_dir_.path(), in_memory_env_.get(), file_task_runner())); 101 NULL, data_dir_.path(), in_memory_env_.get(), file_task_runner()));
102 backend_.reset(new QuotaBackendImpl(file_task_runner(), 102 backend_.reset(new QuotaBackendImpl(file_task_runner(),
103 file_util_.get(), 103 file_util_.get(),
104 &file_system_usage_cache_, 104 &file_system_usage_cache_,
105 quota_manager_proxy_.get())); 105 quota_manager_proxy_.get()));
106 } 106 }
107 107
108 virtual void TearDown() OVERRIDE { 108 virtual void TearDown() override {
109 backend_.reset(); 109 backend_.reset();
110 quota_manager_proxy_ = NULL; 110 quota_manager_proxy_ = NULL;
111 file_util_.reset(); 111 file_util_.reset();
112 message_loop_.RunUntilIdle(); 112 message_loop_.RunUntilIdle();
113 } 113 }
114 114
115 protected: 115 protected:
116 void InitializeForOriginAndType(const GURL& origin, 116 void InitializeForOriginAndType(const GURL& origin,
117 storage::FileSystemType type) { 117 storage::FileSystemType type) {
118 ASSERT_TRUE(file_util_->InitOriginDatabase(origin, true /* create */)); 118 ASSERT_TRUE(file_util_->InitOriginDatabase(origin, true /* create */));
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 uint32 dirty = 0; 263 uint32 dirty = 0;
264 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); 264 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty));
265 EXPECT_EQ(1u, dirty); 265 EXPECT_EQ(1u, dirty);
266 266
267 backend_->DecrementDirtyCount(GURL(kOrigin), type); 267 backend_->DecrementDirtyCount(GURL(kOrigin), type);
268 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); 268 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty));
269 EXPECT_EQ(0u, dirty); 269 EXPECT_EQ(0u, dirty);
270 } 270 }
271 271
272 } // namespace content 272 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/mock_quota_manager_proxy.h ('k') | content/browser/quota/quota_reservation_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698