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

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

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (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_reservation_manager.h" 5 #include "storage/browser/fileapi/quota/quota_reservation_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 29 matching lines...) Expand all
40 base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE); 40 base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
41 ASSERT_TRUE(file.IsValid()); 41 ASSERT_TRUE(file.IsValid());
42 ASSERT_TRUE(file.SetLength(size)); 42 ASSERT_TRUE(file.SetLength(size));
43 } 43 }
44 44
45 class FakeBackend : public QuotaReservationManager::QuotaBackend { 45 class FakeBackend : public QuotaReservationManager::QuotaBackend {
46 public: 46 public:
47 FakeBackend() 47 FakeBackend()
48 : on_memory_usage_(kInitialFileSize), 48 : on_memory_usage_(kInitialFileSize),
49 on_disk_usage_(kInitialFileSize) {} 49 on_disk_usage_(kInitialFileSize) {}
50 virtual ~FakeBackend() {} 50 ~FakeBackend() override {}
51 51
52 virtual void ReserveQuota(const GURL& origin, 52 void ReserveQuota(const GURL& origin,
53 storage::FileSystemType type, 53 storage::FileSystemType type,
54 int64 delta, 54 int64 delta,
55 const ReserveQuotaCallback& callback) override { 55 const ReserveQuotaCallback& callback) override {
56 EXPECT_EQ(GURL(kOrigin), origin); 56 EXPECT_EQ(GURL(kOrigin), origin);
57 EXPECT_EQ(kType, type); 57 EXPECT_EQ(kType, type);
58 on_memory_usage_ += delta; 58 on_memory_usage_ += delta;
59 base::MessageLoopProxy::current()->PostTask( 59 base::MessageLoopProxy::current()->PostTask(
60 FROM_HERE, 60 FROM_HERE,
61 base::Bind(base::IgnoreResult(callback), base::File::FILE_OK, delta)); 61 base::Bind(base::IgnoreResult(callback), base::File::FILE_OK, delta));
62 } 62 }
63 63
64 virtual void ReleaseReservedQuota(const GURL& origin, 64 void ReleaseReservedQuota(const GURL& origin,
65 storage::FileSystemType type, 65 storage::FileSystemType type,
66 int64 size) override { 66 int64 size) override {
67 EXPECT_LE(0, size); 67 EXPECT_LE(0, size);
68 EXPECT_EQ(GURL(kOrigin), origin); 68 EXPECT_EQ(GURL(kOrigin), origin);
69 EXPECT_EQ(kType, type); 69 EXPECT_EQ(kType, type);
70 on_memory_usage_ -= size; 70 on_memory_usage_ -= size;
71 } 71 }
72 72
73 virtual void CommitQuotaUsage(const GURL& origin, 73 void CommitQuotaUsage(const GURL& origin,
74 storage::FileSystemType type, 74 storage::FileSystemType type,
75 int64 delta) override { 75 int64 delta) override {
76 EXPECT_EQ(GURL(kOrigin), origin); 76 EXPECT_EQ(GURL(kOrigin), origin);
77 EXPECT_EQ(kType, type); 77 EXPECT_EQ(kType, type);
78 on_disk_usage_ += delta; 78 on_disk_usage_ += delta;
79 on_memory_usage_ += delta; 79 on_memory_usage_ += delta;
80 } 80 }
81 81
82 virtual void IncrementDirtyCount(const GURL& origin, 82 void IncrementDirtyCount(const GURL& origin,
83 storage::FileSystemType type) override {} 83 storage::FileSystemType type) override {}
84 virtual void DecrementDirtyCount(const GURL& origin, 84 void DecrementDirtyCount(const GURL& origin,
85 storage::FileSystemType type) override {} 85 storage::FileSystemType type) override {}
86 86
87 int64 on_memory_usage() { return on_memory_usage_; } 87 int64 on_memory_usage() { return on_memory_usage_; }
88 int64 on_disk_usage() { return on_disk_usage_; } 88 int64 on_disk_usage() { return on_disk_usage_; }
89 89
90 private: 90 private:
91 int64 on_memory_usage_; 91 int64 on_memory_usage_;
92 int64 on_disk_usage_; 92 int64 on_disk_usage_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(FakeBackend); 94 DISALLOW_COPY_AND_ASSIGN(FakeBackend);
95 }; 95 };
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 358
359 EXPECT_EQ(kInitialFileSize + 10, GetFileSize(file_path())); 359 EXPECT_EQ(kInitialFileSize + 10, GetFileSize(file_path()));
360 EXPECT_EQ(kInitialFileSize + 15 + 20, fake_backend()->on_memory_usage()); 360 EXPECT_EQ(kInitialFileSize + 15 + 20, fake_backend()->on_memory_usage());
361 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_disk_usage()); 361 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_disk_usage());
362 362
363 reservation2 = NULL; 363 reservation2 = NULL;
364 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_memory_usage()); 364 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_memory_usage());
365 } 365 }
366 366
367 } // namespace content 367 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698