OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
6 #include <sstream> | 6 #include <sstream> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/message_loop_proxy.h" | 15 #include "base/message_loop_proxy.h" |
15 #include "base/scoped_temp_dir.h" | |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "webkit/quota/mock_special_storage_policy.h" | 21 #include "webkit/quota/mock_special_storage_policy.h" |
22 #include "webkit/quota/mock_storage_client.h" | 22 #include "webkit/quota/mock_storage_client.h" |
23 #include "webkit/quota/quota_database.h" | 23 #include "webkit/quota/quota_database.h" |
24 #include "webkit/quota/quota_manager.h" | 24 #include "webkit/quota/quota_manager.h" |
25 | 25 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 int status_callback_count() const { return status_callback_count_; } | 397 int status_callback_count() const { return status_callback_count_; } |
398 void reset_status_callback_count() { status_callback_count_ = 0; } | 398 void reset_status_callback_count() { status_callback_count_ = 0; } |
399 | 399 |
400 private: | 400 private: |
401 base::Time IncrementMockTime() { | 401 base::Time IncrementMockTime() { |
402 ++mock_time_counter_; | 402 ++mock_time_counter_; |
403 return base::Time::FromDoubleT(mock_time_counter_ * 10.0); | 403 return base::Time::FromDoubleT(mock_time_counter_ * 10.0); |
404 } | 404 } |
405 | 405 |
406 MessageLoop message_loop_; | 406 MessageLoop message_loop_; |
407 ScopedTempDir data_dir_; | 407 base::ScopedTempDir data_dir_; |
408 base::WeakPtrFactory<QuotaManagerTest> weak_factory_; | 408 base::WeakPtrFactory<QuotaManagerTest> weak_factory_; |
409 | 409 |
410 scoped_refptr<QuotaManager> quota_manager_; | 410 scoped_refptr<QuotaManager> quota_manager_; |
411 scoped_refptr<MockSpecialStoragePolicy> mock_special_storage_policy_; | 411 scoped_refptr<MockSpecialStoragePolicy> mock_special_storage_policy_; |
412 | 412 |
413 QuotaStatusCode quota_status_; | 413 QuotaStatusCode quota_status_; |
414 UsageInfoEntries usage_info_; | 414 UsageInfoEntries usage_info_; |
415 std::string host_; | 415 std::string host_; |
416 StorageType type_; | 416 StorageType type_; |
417 int64 usage_; | 417 int64 usage_; |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); | 2046 EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); |
2047 | 2047 |
2048 DeleteHostData("foo.com", kTemp, | 2048 DeleteHostData("foo.com", kTemp, |
2049 QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); | 2049 QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); |
2050 MessageLoop::current()->RunAllPending(); | 2050 MessageLoop::current()->RunAllPending(); |
2051 GetHostUsage("foo.com", kTemp); | 2051 GetHostUsage("foo.com", kTemp); |
2052 MessageLoop::current()->RunAllPending(); | 2052 MessageLoop::current()->RunAllPending(); |
2053 EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); | 2053 EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); |
2054 } | 2054 } |
2055 } // namespace quota | 2055 } // namespace quota |
OLD | NEW |