| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <memory> |
| 9 #include <set> | 10 #include <set> |
| 10 #include <sstream> | 11 #include <sstream> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/bind.h" | 14 #include "base/bind.h" |
| 14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 15 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 19 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
| 20 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
| 21 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 22 #include "base/test/histogram_tester.h" | 23 #include "base/test/histogram_tester.h" |
| 23 #include "base/thread_task_runner_handle.h" | 24 #include "base/thread_task_runner_handle.h" |
| 24 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 25 #include "content/public/test/mock_special_storage_policy.h" | 26 #include "content/public/test/mock_special_storage_policy.h" |
| 26 #include "content/public/test/mock_storage_client.h" | 27 #include "content/public/test/mock_storage_client.h" |
| 27 #include "storage/browser/quota/quota_database.h" | 28 #include "storage/browser/quota/quota_database.h" |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1296 |
| 1296 TEST_F(QuotaManagerTest, GetAvailableSpaceTest) { | 1297 TEST_F(QuotaManagerTest, GetAvailableSpaceTest) { |
| 1297 GetAvailableSpace(); | 1298 GetAvailableSpace(); |
| 1298 base::RunLoop().RunUntilIdle(); | 1299 base::RunLoop().RunUntilIdle(); |
| 1299 EXPECT_EQ(kQuotaStatusOk, status()); | 1300 EXPECT_EQ(kQuotaStatusOk, status()); |
| 1300 EXPECT_LE(0, available_space()); | 1301 EXPECT_LE(0, available_space()); |
| 1301 } | 1302 } |
| 1302 | 1303 |
| 1303 TEST_F(QuotaManagerTest, SetTemporaryStorageEvictionPolicy) { | 1304 TEST_F(QuotaManagerTest, SetTemporaryStorageEvictionPolicy) { |
| 1304 quota_manager()->SetTemporaryStorageEvictionPolicy( | 1305 quota_manager()->SetTemporaryStorageEvictionPolicy( |
| 1305 make_scoped_ptr(new TestEvictionPolicy)); | 1306 base::WrapUnique(new TestEvictionPolicy)); |
| 1306 | 1307 |
| 1307 GetEvictionOrigin(kTemp); | 1308 GetEvictionOrigin(kTemp); |
| 1308 base::RunLoop().RunUntilIdle(); | 1309 base::RunLoop().RunUntilIdle(); |
| 1309 EXPECT_EQ(kTestEvictionOrigin, eviction_origin()); | 1310 EXPECT_EQ(kTestEvictionOrigin, eviction_origin()); |
| 1310 } | 1311 } |
| 1311 | 1312 |
| 1312 TEST_F(QuotaManagerTest, EvictOriginData) { | 1313 TEST_F(QuotaManagerTest, EvictOriginData) { |
| 1313 static const MockOriginData kData1[] = { | 1314 static const MockOriginData kData1[] = { |
| 1314 { "http://foo.com/", kTemp, 1 }, | 1315 { "http://foo.com/", kTemp, 1 }, |
| 1315 { "http://foo.com:1/", kTemp, 20 }, | 1316 { "http://foo.com:1/", kTemp, 20 }, |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 base::FilePath tmp_dir; | 2302 base::FilePath tmp_dir; |
| 2302 ASSERT_TRUE(base::GetTempDir(&tmp_dir)); | 2303 ASSERT_TRUE(base::GetTempDir(&tmp_dir)); |
| 2303 uint64_t available_space = 0; | 2304 uint64_t available_space = 0; |
| 2304 uint64_t total_size = 0; | 2305 uint64_t total_size = 0; |
| 2305 EXPECT_TRUE(GetVolumeInfo(tmp_dir, &available_space, &total_size)); | 2306 EXPECT_TRUE(GetVolumeInfo(tmp_dir, &available_space, &total_size)); |
| 2306 EXPECT_GT(available_space, 0u) << tmp_dir.value(); | 2307 EXPECT_GT(available_space, 0u) << tmp_dir.value(); |
| 2307 EXPECT_GT(total_size, 0u) << tmp_dir.value(); | 2308 EXPECT_GT(total_size, 0u) << tmp_dir.value(); |
| 2308 } | 2309 } |
| 2309 | 2310 |
| 2310 } // namespace content | 2311 } // namespace content |
| OLD | NEW |