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

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

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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 <stdint.h>
6
5 #include <list> 7 #include <list>
6 #include <map> 8 #include <map>
7 #include <utility> 9 #include <utility>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
13 #include "base/run_loop.h" 16 #include "base/run_loop.h"
14 #include "content/public/test/mock_storage_client.h" 17 #include "content/public/test/mock_storage_client.h"
15 #include "storage/browser/quota/quota_manager.h" 18 #include "storage/browser/quota/quota_manager.h"
16 #include "storage/browser/quota/quota_temporary_storage_evictor.h" 19 #include "storage/browser/quota/quota_temporary_storage_evictor.h"
17 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
18 21
19 using storage::QuotaTemporaryStorageEvictor; 22 using storage::QuotaTemporaryStorageEvictor;
20 using storage::StorageType; 23 using storage::StorageType;
(...skipping 13 matching lines...) Expand all
34 error_on_evict_origin_data_(false), 37 error_on_evict_origin_data_(false),
35 error_on_get_usage_and_quota_(false) {} 38 error_on_get_usage_and_quota_(false) {}
36 39
37 void EvictOriginData(const GURL& origin, 40 void EvictOriginData(const GURL& origin,
38 StorageType type, 41 StorageType type,
39 const EvictOriginDataCallback& callback) override { 42 const EvictOriginDataCallback& callback) override {
40 if (error_on_evict_origin_data_) { 43 if (error_on_evict_origin_data_) {
41 callback.Run(storage::kQuotaErrorInvalidModification); 44 callback.Run(storage::kQuotaErrorInvalidModification);
42 return; 45 return;
43 } 46 }
44 int64 origin_usage = EnsureOriginRemoved(origin); 47 int64_t origin_usage = EnsureOriginRemoved(origin);
45 if (origin_usage >= 0) 48 if (origin_usage >= 0)
46 available_space_ += origin_usage; 49 available_space_ += origin_usage;
47 callback.Run(storage::kQuotaStatusOk); 50 callback.Run(storage::kQuotaStatusOk);
48 } 51 }
49 52
50 void GetUsageAndQuotaForEviction( 53 void GetUsageAndQuotaForEviction(
51 const UsageAndQuotaCallback& callback) override { 54 const UsageAndQuotaCallback& callback) override {
52 if (error_on_get_usage_and_quota_) { 55 if (error_on_get_usage_and_quota_) {
53 callback.Run(storage::kQuotaErrorInvalidAccess, UsageAndQuota()); 56 callback.Run(storage::kQuotaErrorInvalidAccess, UsageAndQuota());
54 return; 57 return;
55 } 58 }
56 if (!task_for_get_usage_and_quota_.is_null()) 59 if (!task_for_get_usage_and_quota_.is_null())
57 task_for_get_usage_and_quota_.Run(); 60 task_for_get_usage_and_quota_.Run();
58 UsageAndQuota quota_and_usage(-1, GetUsage(), quota_, available_space_); 61 UsageAndQuota quota_and_usage(-1, GetUsage(), quota_, available_space_);
59 callback.Run(storage::kQuotaStatusOk, quota_and_usage); 62 callback.Run(storage::kQuotaStatusOk, quota_and_usage);
60 } 63 }
61 64
62 void GetEvictionOrigin(StorageType type, 65 void GetEvictionOrigin(StorageType type,
63 const std::set<GURL>& exceptions, 66 const std::set<GURL>& exceptions,
64 int64 global_quota, 67 int64_t global_quota,
65 const storage::GetOriginCallback& callback) override { 68 const storage::GetOriginCallback& callback) override {
66 if (origin_order_.empty()) 69 if (origin_order_.empty())
67 callback.Run(GURL()); 70 callback.Run(GURL());
68 else 71 else
69 callback.Run(GURL(origin_order_.front())); 72 callback.Run(GURL(origin_order_.front()));
70 } 73 }
71 74
72 int64 GetUsage() const { 75 int64_t GetUsage() const {
73 int64 total_usage = 0; 76 int64_t total_usage = 0;
74 for (std::map<GURL, int64>::const_iterator p = origins_.begin(); 77 for (std::map<GURL, int64_t>::const_iterator p = origins_.begin();
75 p != origins_.end(); 78 p != origins_.end(); ++p)
76 ++p)
77 total_usage += p->second; 79 total_usage += p->second;
78 return total_usage; 80 return total_usage;
79 } 81 }
80 82
81 void set_quota(int64 quota) { 83 void set_quota(int64_t quota) { quota_ = quota; }
82 quota_ = quota; 84 void set_available_space(int64_t available_space) {
83 }
84 void set_available_space(int64 available_space) {
85 available_space_ = available_space; 85 available_space_ = available_space;
86 } 86 }
87 void set_task_for_get_usage_and_quota(const base::Closure& task) { 87 void set_task_for_get_usage_and_quota(const base::Closure& task) {
88 task_for_get_usage_and_quota_= task; 88 task_for_get_usage_and_quota_= task;
89 } 89 }
90 void set_error_on_evict_origin_data(bool error_on_evict_origin_data) { 90 void set_error_on_evict_origin_data(bool error_on_evict_origin_data) {
91 error_on_evict_origin_data_ = error_on_evict_origin_data; 91 error_on_evict_origin_data_ = error_on_evict_origin_data;
92 } 92 }
93 void set_error_on_get_usage_and_quota(bool error_on_get_usage_and_quota) { 93 void set_error_on_get_usage_and_quota(bool error_on_get_usage_and_quota) {
94 error_on_get_usage_and_quota_ = error_on_get_usage_and_quota; 94 error_on_get_usage_and_quota_ = error_on_get_usage_and_quota;
95 } 95 }
96 96
97 // Simulates an access to |origin|. It reorders the internal LRU list. 97 // Simulates an access to |origin|. It reorders the internal LRU list.
98 // It internally uses AddOrigin(). 98 // It internally uses AddOrigin().
99 void AccessOrigin(const GURL& origin) { 99 void AccessOrigin(const GURL& origin) {
100 std::map<GURL, int64>::iterator found = origins_.find(origin); 100 std::map<GURL, int64_t>::iterator found = origins_.find(origin);
101 EXPECT_TRUE(origins_.end() != found); 101 EXPECT_TRUE(origins_.end() != found);
102 AddOrigin(origin, found->second); 102 AddOrigin(origin, found->second);
103 } 103 }
104 104
105 // Simulates adding or overwriting the |origin| to the internal origin set 105 // Simulates adding or overwriting the |origin| to the internal origin set
106 // with the |usage|. It also adds or moves the |origin| to the end of the 106 // with the |usage|. It also adds or moves the |origin| to the end of the
107 // LRU list. 107 // LRU list.
108 void AddOrigin(const GURL& origin, int64 usage) { 108 void AddOrigin(const GURL& origin, int64_t usage) {
109 EnsureOriginRemoved(origin); 109 EnsureOriginRemoved(origin);
110 origin_order_.push_back(origin); 110 origin_order_.push_back(origin);
111 origins_[origin] = usage; 111 origins_[origin] = usage;
112 } 112 }
113 113
114 private: 114 private:
115 int64 EnsureOriginRemoved(const GURL& origin) { 115 int64_t EnsureOriginRemoved(const GURL& origin) {
116 int64 origin_usage; 116 int64_t origin_usage;
117 if (origins_.find(origin) == origins_.end()) 117 if (origins_.find(origin) == origins_.end())
118 return -1; 118 return -1;
119 else 119 else
120 origin_usage = origins_[origin]; 120 origin_usage = origins_[origin];
121 121
122 origins_.erase(origin); 122 origins_.erase(origin);
123 origin_order_.remove(origin); 123 origin_order_.remove(origin);
124 return origin_usage; 124 return origin_usage;
125 } 125 }
126 126
127 int64 quota_; 127 int64_t quota_;
128 int64 available_space_; 128 int64_t available_space_;
129 std::list<GURL> origin_order_; 129 std::list<GURL> origin_order_;
130 std::map<GURL, int64> origins_; 130 std::map<GURL, int64_t> origins_;
131 bool error_on_evict_origin_data_; 131 bool error_on_evict_origin_data_;
132 bool error_on_get_usage_and_quota_; 132 bool error_on_get_usage_and_quota_;
133 133
134 base::Closure task_for_get_usage_and_quota_; 134 base::Closure task_for_get_usage_and_quota_;
135 }; 135 };
136 136
137 } // namespace 137 } // namespace
138 138
139 class QuotaTemporaryStorageEvictorTest : public testing::Test { 139 class QuotaTemporaryStorageEvictorTest : public testing::Test {
140 public: 140 public:
141 QuotaTemporaryStorageEvictorTest() 141 QuotaTemporaryStorageEvictorTest()
142 : num_get_usage_and_quota_for_eviction_(0), 142 : num_get_usage_and_quota_for_eviction_(0),
143 weak_factory_(this) {} 143 weak_factory_(this) {}
144 144
145 void SetUp() override { 145 void SetUp() override {
146 quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this)); 146 quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this));
147 147
148 // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0 148 // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0
149 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( 149 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor(
150 quota_eviction_handler_.get(), 0)); 150 quota_eviction_handler_.get(), 0));
151 } 151 }
152 152
153 void TearDown() override { 153 void TearDown() override {
154 temporary_storage_evictor_.reset(); 154 temporary_storage_evictor_.reset();
155 quota_eviction_handler_.reset(); 155 quota_eviction_handler_.reset();
156 base::RunLoop().RunUntilIdle(); 156 base::RunLoop().RunUntilIdle();
157 } 157 }
158 158
159 void TaskForRepeatedEvictionTest( 159 void TaskForRepeatedEvictionTest(
160 const std::pair<GURL, int64>& origin_to_be_added, 160 const std::pair<GURL, int64_t>& origin_to_be_added,
161 const GURL& origin_to_be_accessed, 161 const GURL& origin_to_be_accessed,
162 int expected_usage_after_first, 162 int expected_usage_after_first,
163 int expected_usage_after_second) { 163 int expected_usage_after_second) {
164 EXPECT_GE(4, num_get_usage_and_quota_for_eviction_); 164 EXPECT_GE(4, num_get_usage_and_quota_for_eviction_);
165 switch (num_get_usage_and_quota_for_eviction_) { 165 switch (num_get_usage_and_quota_for_eviction_) {
166 case 2: 166 case 2:
167 EXPECT_EQ(expected_usage_after_first, 167 EXPECT_EQ(expected_usage_after_first,
168 quota_eviction_handler()->GetUsage()); 168 quota_eviction_handler()->GetUsage());
169 if (!origin_to_be_added.first.is_empty()) 169 if (!origin_to_be_added.first.is_empty())
170 quota_eviction_handler()->AddOrigin(origin_to_be_added.first, 170 quota_eviction_handler()->AddOrigin(origin_to_be_added.first,
(...skipping 25 matching lines...) Expand all
196 } 196 }
197 197
198 void set_repeated_eviction(bool repeated_eviction) const { 198 void set_repeated_eviction(bool repeated_eviction) const {
199 return temporary_storage_evictor_->set_repeated_eviction(repeated_eviction); 199 return temporary_storage_evictor_->set_repeated_eviction(repeated_eviction);
200 } 200 }
201 201
202 int num_get_usage_and_quota_for_eviction() const { 202 int num_get_usage_and_quota_for_eviction() const {
203 return num_get_usage_and_quota_for_eviction_; 203 return num_get_usage_and_quota_for_eviction_;
204 } 204 }
205 205
206 int64 default_min_available_disk_space_to_start_eviction() const { 206 int64_t default_min_available_disk_space_to_start_eviction() const {
207 return 1000 * 1000 * 500; 207 return 1000 * 1000 * 500;
208 } 208 }
209 209
210 void set_min_available_disk_space_to_start_eviction(int64 value) const { 210 void set_min_available_disk_space_to_start_eviction(int64_t value) const {
211 temporary_storage_evictor_->set_min_available_disk_space_to_start_eviction( 211 temporary_storage_evictor_->set_min_available_disk_space_to_start_eviction(
212 value); 212 value);
213 } 213 }
214 214
215 void reset_min_available_disk_space_to_start_eviction() const { 215 void reset_min_available_disk_space_to_start_eviction() const {
216 temporary_storage_evictor_-> 216 temporary_storage_evictor_->
217 reset_min_available_disk_space_to_start_eviction(); 217 reset_min_available_disk_space_to_start_eviction();
218 } 218 }
219 219
220 base::MessageLoop message_loop_; 220 base::MessageLoop message_loop_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 EXPECT_EQ(450 + 400, quota_eviction_handler()->GetUsage()); 261 EXPECT_EQ(450 + 400, quota_eviction_handler()->GetUsage());
262 262
263 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); 263 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin);
264 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); 264 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
265 EXPECT_EQ(2, statistics().num_evicted_origins); 265 EXPECT_EQ(2, statistics().num_evicted_origins);
266 EXPECT_EQ(1, statistics().num_eviction_rounds); 266 EXPECT_EQ(1, statistics().num_eviction_rounds);
267 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); 267 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds);
268 } 268 }
269 269
270 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionTest) { 270 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionTest) {
271 const int64 a_size = 400; 271 const int64_t a_size = 400;
272 const int64 b_size = 150; 272 const int64_t b_size = 150;
273 const int64 c_size = 120; 273 const int64_t c_size = 120;
274 const int64 d_size = 292; 274 const int64_t d_size = 292;
275 const int64 initial_total_size = a_size + b_size + c_size + d_size; 275 const int64_t initial_total_size = a_size + b_size + c_size + d_size;
276 const int64 e_size = 275; 276 const int64_t e_size = 275;
277 277
278 quota_eviction_handler()->AddOrigin(GURL("http://www.d.com"), d_size); 278 quota_eviction_handler()->AddOrigin(GURL("http://www.d.com"), d_size);
279 quota_eviction_handler()->AddOrigin(GURL("http://www.c.com"), c_size); 279 quota_eviction_handler()->AddOrigin(GURL("http://www.c.com"), c_size);
280 quota_eviction_handler()->AddOrigin(GURL("http://www.b.com"), b_size); 280 quota_eviction_handler()->AddOrigin(GURL("http://www.b.com"), b_size);
281 quota_eviction_handler()->AddOrigin(GURL("http://www.a.com"), a_size); 281 quota_eviction_handler()->AddOrigin(GURL("http://www.a.com"), a_size);
282 quota_eviction_handler()->set_quota(1000); 282 quota_eviction_handler()->set_quota(1000);
283 quota_eviction_handler()->set_available_space(1000000000); 283 quota_eviction_handler()->set_available_space(1000000000);
284 quota_eviction_handler()->set_task_for_get_usage_and_quota( 284 quota_eviction_handler()->set_task_for_get_usage_and_quota(
285 base::Bind(&QuotaTemporaryStorageEvictorTest::TaskForRepeatedEvictionTest, 285 base::Bind(&QuotaTemporaryStorageEvictorTest::TaskForRepeatedEvictionTest,
286 weak_factory_.GetWeakPtr(), 286 weak_factory_.GetWeakPtr(),
287 std::make_pair(GURL("http://www.e.com"), e_size), GURL(), 287 std::make_pair(GURL("http://www.e.com"), e_size), GURL(),
288 initial_total_size - d_size, 288 initial_total_size - d_size,
289 initial_total_size - d_size + e_size - c_size)); 289 initial_total_size - d_size + e_size - c_size));
290 EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage()); 290 EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage());
291 temporary_storage_evictor()->Start(); 291 temporary_storage_evictor()->Start();
292 base::RunLoop().RunUntilIdle(); 292 base::RunLoop().RunUntilIdle();
293 EXPECT_EQ(initial_total_size - d_size + e_size - c_size - b_size, 293 EXPECT_EQ(initial_total_size - d_size + e_size - c_size - b_size,
294 quota_eviction_handler()->GetUsage()); 294 quota_eviction_handler()->GetUsage());
295 EXPECT_EQ(5, num_get_usage_and_quota_for_eviction()); 295 EXPECT_EQ(5, num_get_usage_and_quota_for_eviction());
296 296
297 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); 297 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin);
298 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); 298 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
299 EXPECT_EQ(3, statistics().num_evicted_origins); 299 EXPECT_EQ(3, statistics().num_evicted_origins);
300 EXPECT_EQ(2, statistics().num_eviction_rounds); 300 EXPECT_EQ(2, statistics().num_eviction_rounds);
301 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); 301 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds);
302 } 302 }
303 303
304 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionSkippedTest) { 304 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionSkippedTest) {
305 const int64 a_size = 400; 305 const int64_t a_size = 400;
306 const int64 b_size = 150; 306 const int64_t b_size = 150;
307 const int64 c_size = 120; 307 const int64_t c_size = 120;
308 const int64 d_size = 292; 308 const int64_t d_size = 292;
309 const int64 initial_total_size = a_size + b_size + c_size + d_size; 309 const int64_t initial_total_size = a_size + b_size + c_size + d_size;
310 310
311 quota_eviction_handler()->AddOrigin(GURL("http://www.d.com"), d_size); 311 quota_eviction_handler()->AddOrigin(GURL("http://www.d.com"), d_size);
312 quota_eviction_handler()->AddOrigin(GURL("http://www.c.com"), c_size); 312 quota_eviction_handler()->AddOrigin(GURL("http://www.c.com"), c_size);
313 quota_eviction_handler()->AddOrigin(GURL("http://www.b.com"), b_size); 313 quota_eviction_handler()->AddOrigin(GURL("http://www.b.com"), b_size);
314 quota_eviction_handler()->AddOrigin(GURL("http://www.a.com"), a_size); 314 quota_eviction_handler()->AddOrigin(GURL("http://www.a.com"), a_size);
315 quota_eviction_handler()->set_quota(1000); 315 quota_eviction_handler()->set_quota(1000);
316 quota_eviction_handler()->set_available_space(1000000000); 316 quota_eviction_handler()->set_available_space(1000000000);
317 quota_eviction_handler()->set_task_for_get_usage_and_quota( 317 quota_eviction_handler()->set_task_for_get_usage_and_quota(
318 base::Bind(&QuotaTemporaryStorageEvictorTest::TaskForRepeatedEvictionTest, 318 base::Bind(&QuotaTemporaryStorageEvictorTest::TaskForRepeatedEvictionTest,
319 weak_factory_.GetWeakPtr(), std::make_pair(GURL(), 0), GURL(), 319 weak_factory_.GetWeakPtr(), std::make_pair(GURL(), 0), GURL(),
320 initial_total_size - d_size, initial_total_size - d_size)); 320 initial_total_size - d_size, initial_total_size - d_size));
321 EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage()); 321 EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage());
322 set_repeated_eviction(true); 322 set_repeated_eviction(true);
323 temporary_storage_evictor()->Start(); 323 temporary_storage_evictor()->Start();
324 base::RunLoop().RunUntilIdle(); 324 base::RunLoop().RunUntilIdle();
325 EXPECT_EQ(initial_total_size - d_size, quota_eviction_handler()->GetUsage()); 325 EXPECT_EQ(initial_total_size - d_size, quota_eviction_handler()->GetUsage());
326 EXPECT_EQ(4, num_get_usage_and_quota_for_eviction()); 326 EXPECT_EQ(4, num_get_usage_and_quota_for_eviction());
327 327
328 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); 328 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin);
329 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); 329 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
330 EXPECT_EQ(1, statistics().num_evicted_origins); 330 EXPECT_EQ(1, statistics().num_evicted_origins);
331 EXPECT_EQ(3, statistics().num_eviction_rounds); 331 EXPECT_EQ(3, statistics().num_eviction_rounds);
332 EXPECT_EQ(2, statistics().num_skipped_eviction_rounds); 332 EXPECT_EQ(2, statistics().num_skipped_eviction_rounds);
333 } 333 }
334 334
335 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionWithAccessOriginTest) { 335 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionWithAccessOriginTest) {
336 const int64 a_size = 400; 336 const int64_t a_size = 400;
337 const int64 b_size = 150; 337 const int64_t b_size = 150;
338 const int64 c_size = 120; 338 const int64_t c_size = 120;
339 const int64 d_size = 292; 339 const int64_t d_size = 292;
340 const int64 initial_total_size = a_size + b_size + c_size + d_size; 340 const int64_t initial_total_size = a_size + b_size + c_size + d_size;
341 const int64 e_size = 275; 341 const int64_t e_size = 275;
342 342
343 quota_eviction_handler()->AddOrigin(GURL("http://www.d.com"), d_size); 343 quota_eviction_handler()->AddOrigin(GURL("http://www.d.com"), d_size);
344 quota_eviction_handler()->AddOrigin(GURL("http://www.c.com"), c_size); 344 quota_eviction_handler()->AddOrigin(GURL("http://www.c.com"), c_size);
345 quota_eviction_handler()->AddOrigin(GURL("http://www.b.com"), b_size); 345 quota_eviction_handler()->AddOrigin(GURL("http://www.b.com"), b_size);
346 quota_eviction_handler()->AddOrigin(GURL("http://www.a.com"), a_size); 346 quota_eviction_handler()->AddOrigin(GURL("http://www.a.com"), a_size);
347 quota_eviction_handler()->set_quota(1000); 347 quota_eviction_handler()->set_quota(1000);
348 quota_eviction_handler()->set_available_space(1000000000); 348 quota_eviction_handler()->set_available_space(1000000000);
349 quota_eviction_handler()->set_task_for_get_usage_and_quota( 349 quota_eviction_handler()->set_task_for_get_usage_and_quota(
350 base::Bind(&QuotaTemporaryStorageEvictorTest::TaskForRepeatedEvictionTest, 350 base::Bind(&QuotaTemporaryStorageEvictorTest::TaskForRepeatedEvictionTest,
351 weak_factory_.GetWeakPtr(), 351 weak_factory_.GetWeakPtr(),
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage()); 404 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage());
405 405
406 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); 406 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin);
407 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); 407 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
408 EXPECT_EQ(2, statistics().num_evicted_origins); 408 EXPECT_EQ(2, statistics().num_evicted_origins);
409 EXPECT_EQ(1, statistics().num_eviction_rounds); 409 EXPECT_EQ(1, statistics().num_eviction_rounds);
410 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); 410 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds);
411 } 411 }
412 412
413 } // namespace content 413 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/quota_reservation_manager_unittest.cc ('k') | content/browser/quota/storage_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698