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

Side by Side Diff: webkit/quota/usage_tracker_unittest.cc

Issue 15925005: [Quota][Clean up] Drop non-informative StorageType parameter on GetOriginsForType callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « webkit/quota/usage_tracker.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/message_loop.h" 6 #include "base/message_loop.h"
7 #include "net/base/net_util.h" 7 #include "net/base/net_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "webkit/quota/mock_special_storage_policy.h" 9 #include "webkit/quota/mock_special_storage_policy.h"
10 #include "webkit/quota/usage_tracker.h" 10 #include "webkit/quota/usage_tracker.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 virtual void GetOriginsForType(StorageType type, 57 virtual void GetOriginsForType(StorageType type,
58 const GetOriginsCallback& callback) OVERRIDE { 58 const GetOriginsCallback& callback) OVERRIDE {
59 EXPECT_EQ(kStorageTypeTemporary, type); 59 EXPECT_EQ(kStorageTypeTemporary, type);
60 std::set<GURL> origins; 60 std::set<GURL> origins;
61 for (UsageMap::const_iterator itr = usage_map_.begin(); 61 for (UsageMap::const_iterator itr = usage_map_.begin();
62 itr != usage_map_.end(); ++itr) { 62 itr != usage_map_.end(); ++itr) {
63 origins.insert(itr->first); 63 origins.insert(itr->first);
64 } 64 }
65 base::MessageLoop::current()->PostTask(FROM_HERE, 65 base::MessageLoop::current()->PostTask(FROM_HERE,
66 base::Bind(callback, origins, type)); 66 base::Bind(callback, origins));
67 } 67 }
68 68
69 virtual void GetOriginsForHost(StorageType type, 69 virtual void GetOriginsForHost(StorageType type,
70 const std::string& host, 70 const std::string& host,
71 const GetOriginsCallback& callback) OVERRIDE { 71 const GetOriginsCallback& callback) OVERRIDE {
72 EXPECT_EQ(kStorageTypeTemporary, type); 72 EXPECT_EQ(kStorageTypeTemporary, type);
73 std::set<GURL> origins; 73 std::set<GURL> origins;
74 for (UsageMap::const_iterator itr = usage_map_.begin(); 74 for (UsageMap::const_iterator itr = usage_map_.begin();
75 itr != usage_map_.end(); ++itr) { 75 itr != usage_map_.end(); ++itr) {
76 if (net::GetHostOrSpecFromURL(itr->first) == host) 76 if (net::GetHostOrSpecFromURL(itr->first) == host)
77 origins.insert(itr->first); 77 origins.insert(itr->first);
78 } 78 }
79 base::MessageLoop::current()->PostTask(FROM_HERE, 79 base::MessageLoop::current()->PostTask(FROM_HERE,
80 base::Bind(callback, origins, type)); 80 base::Bind(callback, origins));
81 } 81 }
82 82
83 virtual void DeleteOriginData(const GURL& origin, 83 virtual void DeleteOriginData(const GURL& origin,
84 StorageType type, 84 StorageType type,
85 const DeletionCallback& callback) OVERRIDE { 85 const DeletionCallback& callback) OVERRIDE {
86 EXPECT_EQ(kStorageTypeTemporary, type); 86 EXPECT_EQ(kStorageTypeTemporary, type);
87 usage_map_.erase(origin); 87 usage_map_.erase(origin);
88 base::MessageLoop::current()->PostTask( 88 base::MessageLoop::current()->PostTask(
89 FROM_HERE, base::Bind(callback, kQuotaStatusOk)); 89 FROM_HERE, base::Bind(callback, kQuotaStatusOk));
90 } 90 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 UpdateUsage(origin, 100); 268 UpdateUsage(origin, 100);
269 269
270 GetGlobalUsage(&usage, &unlimited_usage); 270 GetGlobalUsage(&usage, &unlimited_usage);
271 GetHostUsage(host, &host_usage); 271 GetHostUsage(host, &host_usage);
272 EXPECT_EQ(500, usage); 272 EXPECT_EQ(500, usage);
273 EXPECT_EQ(0, unlimited_usage); 273 EXPECT_EQ(0, unlimited_usage);
274 EXPECT_EQ(500, host_usage); 274 EXPECT_EQ(500, host_usage);
275 } 275 }
276 276
277 } // namespace quota 277 } // namespace quota
OLDNEW
« no previous file with comments | « webkit/quota/usage_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698