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

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

Issue 1221523003: Add a SiteEngagementEvictionPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get_total_engagement_points
Patch Set: remove unnecessary destructor Created 5 years, 3 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 | « chrome/chrome_tests_unit.gypi ('k') | storage/browser/quota/quota_callbacks.h » ('j') | 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 <list> 5 #include <list>
6 #include <map> 6 #include <map>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (error_on_get_usage_and_quota_) { 52 if (error_on_get_usage_and_quota_) {
53 callback.Run(storage::kQuotaErrorInvalidAccess, UsageAndQuota()); 53 callback.Run(storage::kQuotaErrorInvalidAccess, UsageAndQuota());
54 return; 54 return;
55 } 55 }
56 if (!task_for_get_usage_and_quota_.is_null()) 56 if (!task_for_get_usage_and_quota_.is_null())
57 task_for_get_usage_and_quota_.Run(); 57 task_for_get_usage_and_quota_.Run();
58 UsageAndQuota quota_and_usage(-1, GetUsage(), quota_, available_space_); 58 UsageAndQuota quota_and_usage(-1, GetUsage(), quota_, available_space_);
59 callback.Run(storage::kQuotaStatusOk, quota_and_usage); 59 callback.Run(storage::kQuotaStatusOk, quota_and_usage);
60 } 60 }
61 61
62 void GetLRUOrigin(StorageType type, 62 void GetEvictionOrigin(StorageType type,
63 const GetLRUOriginCallback& callback) override { 63 const storage::GetOriginCallback& callback) override {
64 if (origin_order_.empty()) 64 if (origin_order_.empty())
65 callback.Run(GURL()); 65 callback.Run(GURL());
66 else 66 else
67 callback.Run(GURL(origin_order_.front())); 67 callback.Run(GURL(origin_order_.front()));
68 } 68 }
69 69
70 int64 GetUsage() const { 70 int64 GetUsage() const {
71 int64 total_usage = 0; 71 int64 total_usage = 0;
72 for (std::map<GURL, int64>::const_iterator p = origins_.begin(); 72 for (std::map<GURL, int64>::const_iterator p = origins_.begin();
73 p != origins_.end(); 73 p != origins_.end();
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage()); 402 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage());
403 403
404 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); 404 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin);
405 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); 405 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
406 EXPECT_EQ(2, statistics().num_evicted_origins); 406 EXPECT_EQ(2, statistics().num_evicted_origins);
407 EXPECT_EQ(1, statistics().num_eviction_rounds); 407 EXPECT_EQ(1, statistics().num_eviction_rounds);
408 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); 408 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds);
409 } 409 }
410 410
411 } // namespace content 411 } // namespace content
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | storage/browser/quota/quota_callbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698