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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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> 5 #include <stdint.h>
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <utility> 10 #include <utility>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "content/public/test/mock_storage_client.h" 17 #include "content/public/test/mock_storage_client.h"
18 #include "storage/browser/quota/quota_manager.h" 18 #include "storage/browser/quota/quota_manager.h"
19 #include "storage/browser/quota/quota_temporary_storage_evictor.h" 19 #include "storage/browser/quota/quota_temporary_storage_evictor.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 using storage::QuotaTemporaryStorageEvictor; 22 using storage::QuotaTemporaryStorageEvictor;
23 using storage::StorageType; 23 using storage::StorageType;
24 using storage::UsageAndQuota; 24 using storage::UsageAndQuota;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 temporary_storage_evictor_->set_min_available_disk_space_to_start_eviction( 217 temporary_storage_evictor_->set_min_available_disk_space_to_start_eviction(
218 value); 218 value);
219 } 219 }
220 220
221 void reset_min_available_disk_space_to_start_eviction() const { 221 void reset_min_available_disk_space_to_start_eviction() const {
222 temporary_storage_evictor_-> 222 temporary_storage_evictor_->
223 reset_min_available_disk_space_to_start_eviction(); 223 reset_min_available_disk_space_to_start_eviction();
224 } 224 }
225 225
226 base::MessageLoop message_loop_; 226 base::MessageLoop message_loop_;
227 scoped_ptr<MockQuotaEvictionHandler> quota_eviction_handler_; 227 std::unique_ptr<MockQuotaEvictionHandler> quota_eviction_handler_;
228 scoped_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; 228 std::unique_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_;
229 229
230 int num_get_usage_and_quota_for_eviction_; 230 int num_get_usage_and_quota_for_eviction_;
231 231
232 base::WeakPtrFactory<QuotaTemporaryStorageEvictorTest> weak_factory_; 232 base::WeakPtrFactory<QuotaTemporaryStorageEvictorTest> weak_factory_;
233 233
234 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictorTest); 234 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictorTest);
235 }; 235 };
236 236
237 TEST_F(QuotaTemporaryStorageEvictorTest, SimpleEvictionTest) { 237 TEST_F(QuotaTemporaryStorageEvictorTest, SimpleEvictionTest) {
238 quota_eviction_handler()->AddOrigin(GURL("http://www.z.com"), 3000); 238 quota_eviction_handler()->AddOrigin(GURL("http://www.z.com"), 3000);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage()); 410 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage());
411 411
412 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); 412 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin);
413 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); 413 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
414 EXPECT_EQ(2, statistics().num_evicted_origins); 414 EXPECT_EQ(2, statistics().num_evicted_origins);
415 EXPECT_EQ(1, statistics().num_eviction_rounds); 415 EXPECT_EQ(1, statistics().num_eviction_rounds);
416 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); 416 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds);
417 } 417 }
418 418
419 } // namespace content 419 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/quota_reservation_manager_unittest.cc ('k') | content/browser/resolve_proxy_msg_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698