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

Side by Side Diff: content/browser/quota/usage_tracker_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
« no previous file with comments | « content/browser/quota/storage_monitor_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/public/test/mock_special_storage_policy.h" 7 #include "content/public/test/mock_special_storage_policy.h"
8 #include "net/base/net_util.h" 8 #include "net/base/net_util.h"
9 #include "storage/browser/quota/usage_tracker.h" 9 #include "storage/browser/quota/usage_tracker.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 29 matching lines...) Expand all
40 *usage_out = usage; 40 *usage_out = usage;
41 } 41 }
42 42
43 } // namespace 43 } // namespace
44 44
45 class MockQuotaClient : public QuotaClient { 45 class MockQuotaClient : public QuotaClient {
46 public: 46 public:
47 MockQuotaClient() {} 47 MockQuotaClient() {}
48 virtual ~MockQuotaClient() {} 48 virtual ~MockQuotaClient() {}
49 49
50 virtual ID id() const OVERRIDE { 50 virtual ID id() const override {
51 return kFileSystem; 51 return kFileSystem;
52 } 52 }
53 53
54 virtual void OnQuotaManagerDestroyed() OVERRIDE {} 54 virtual void OnQuotaManagerDestroyed() override {}
55 55
56 virtual void GetOriginUsage(const GURL& origin, 56 virtual void GetOriginUsage(const GURL& origin,
57 StorageType type, 57 StorageType type,
58 const GetUsageCallback& callback) OVERRIDE { 58 const GetUsageCallback& callback) override {
59 EXPECT_EQ(kStorageTypeTemporary, type); 59 EXPECT_EQ(kStorageTypeTemporary, type);
60 int64 usage = GetUsage(origin); 60 int64 usage = GetUsage(origin);
61 base::MessageLoop::current()->PostTask(FROM_HERE, 61 base::MessageLoop::current()->PostTask(FROM_HERE,
62 base::Bind(callback, usage)); 62 base::Bind(callback, usage));
63 } 63 }
64 64
65 virtual void GetOriginsForType(StorageType type, 65 virtual void GetOriginsForType(StorageType type,
66 const GetOriginsCallback& callback) OVERRIDE { 66 const GetOriginsCallback& callback) override {
67 EXPECT_EQ(kStorageTypeTemporary, type); 67 EXPECT_EQ(kStorageTypeTemporary, type);
68 std::set<GURL> origins; 68 std::set<GURL> origins;
69 for (UsageMap::const_iterator itr = usage_map_.begin(); 69 for (UsageMap::const_iterator itr = usage_map_.begin();
70 itr != usage_map_.end(); ++itr) { 70 itr != usage_map_.end(); ++itr) {
71 origins.insert(itr->first); 71 origins.insert(itr->first);
72 } 72 }
73 base::MessageLoop::current()->PostTask(FROM_HERE, 73 base::MessageLoop::current()->PostTask(FROM_HERE,
74 base::Bind(callback, origins)); 74 base::Bind(callback, origins));
75 } 75 }
76 76
77 virtual void GetOriginsForHost(StorageType type, 77 virtual void GetOriginsForHost(StorageType type,
78 const std::string& host, 78 const std::string& host,
79 const GetOriginsCallback& callback) OVERRIDE { 79 const GetOriginsCallback& callback) override {
80 EXPECT_EQ(kStorageTypeTemporary, type); 80 EXPECT_EQ(kStorageTypeTemporary, type);
81 std::set<GURL> origins; 81 std::set<GURL> origins;
82 for (UsageMap::const_iterator itr = usage_map_.begin(); 82 for (UsageMap::const_iterator itr = usage_map_.begin();
83 itr != usage_map_.end(); ++itr) { 83 itr != usage_map_.end(); ++itr) {
84 if (net::GetHostOrSpecFromURL(itr->first) == host) 84 if (net::GetHostOrSpecFromURL(itr->first) == host)
85 origins.insert(itr->first); 85 origins.insert(itr->first);
86 } 86 }
87 base::MessageLoop::current()->PostTask(FROM_HERE, 87 base::MessageLoop::current()->PostTask(FROM_HERE,
88 base::Bind(callback, origins)); 88 base::Bind(callback, origins));
89 } 89 }
90 90
91 virtual void DeleteOriginData(const GURL& origin, 91 virtual void DeleteOriginData(const GURL& origin,
92 StorageType type, 92 StorageType type,
93 const DeletionCallback& callback) OVERRIDE { 93 const DeletionCallback& callback) override {
94 EXPECT_EQ(kStorageTypeTemporary, type); 94 EXPECT_EQ(kStorageTypeTemporary, type);
95 usage_map_.erase(origin); 95 usage_map_.erase(origin);
96 base::MessageLoop::current()->PostTask( 96 base::MessageLoop::current()->PostTask(
97 FROM_HERE, base::Bind(callback, kQuotaStatusOk)); 97 FROM_HERE, base::Bind(callback, kQuotaStatusOk));
98 } 98 }
99 99
100 virtual bool DoesSupport(storage::StorageType type) const OVERRIDE { 100 virtual bool DoesSupport(storage::StorageType type) const override {
101 return type == storage::kStorageTypeTemporary; 101 return type == storage::kStorageTypeTemporary;
102 } 102 }
103 103
104 int64 GetUsage(const GURL& origin) { 104 int64 GetUsage(const GURL& origin) {
105 UsageMap::const_iterator found = usage_map_.find(origin); 105 UsageMap::const_iterator found = usage_map_.find(origin);
106 if (found == usage_map_.end()) 106 if (found == usage_map_.end())
107 return 0; 107 return 0;
108 return found->second; 108 return found->second;
109 } 109 }
110 110
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 GetGlobalLimitedUsage(&limited_usage); 328 GetGlobalLimitedUsage(&limited_usage);
329 GetGlobalUsage(&total_usage, &unlimited_usage); 329 GetGlobalUsage(&total_usage, &unlimited_usage);
330 EXPECT_EQ(1 + 16, limited_usage); 330 EXPECT_EQ(1 + 16, limited_usage);
331 EXPECT_EQ(1 + 2 + 16 + 32, total_usage); 331 EXPECT_EQ(1 + 2 + 16 + 32, total_usage);
332 EXPECT_EQ(2 + 32, unlimited_usage); 332 EXPECT_EQ(2 + 32, unlimited_usage);
333 } 333 }
334 334
335 335
336 } // namespace content 336 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/storage_monitor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698