OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 // Clear the settings from the previous run. | 1039 // Clear the settings from the previous run. |
1040 SetMask(0); | 1040 SetMask(0); |
1041 SetMaxSize(0); | 1041 SetMaxSize(0); |
1042 } | 1042 } |
1043 | 1043 |
1044 InitCache(); | 1044 InitCache(); |
1045 ASSERT_EQ(num_entries + 1, cache_->GetEntryCount()); | 1045 ASSERT_EQ(num_entries + 1, cache_->GetEntryCount()); |
1046 | 1046 |
1047 std::string key("the first key"); | 1047 std::string key("the first key"); |
1048 disk_cache::Entry* entry1; | 1048 disk_cache::Entry* entry1; |
1049 ASSERT_FALSE(cache_->OpenEntry(key, &entry1)); | 1049 ASSERT_NE(net::OK, OpenEntry(key, &entry1)); |
1050 | 1050 |
1051 int actual = cache_->GetEntryCount(); | 1051 int actual = cache_->GetEntryCount(); |
1052 if (num_entries != actual) { | 1052 if (num_entries != actual) { |
1053 ASSERT_TRUE(load); | 1053 ASSERT_TRUE(load); |
1054 // If there is a heavy load, inserting an entry will make another entry | 1054 // If there is a heavy load, inserting an entry will make another entry |
1055 // dirty (on the hash bucket) so two entries are removed. | 1055 // dirty (on the hash bucket) so two entries are removed. |
1056 ASSERT_EQ(num_entries - 1, actual); | 1056 ASSERT_EQ(num_entries - 1, actual); |
1057 } | 1057 } |
1058 | 1058 |
1059 delete cache_; | 1059 delete cache_; |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 // another. | 1697 // another. |
1698 TEST_F(DiskCacheBackendTest, Histograms) { | 1698 TEST_F(DiskCacheBackendTest, Histograms) { |
1699 SetDirectMode(); | 1699 SetDirectMode(); |
1700 InitCache(); | 1700 InitCache(); |
1701 disk_cache::BackendImpl* backend_ = cache_impl_; // Needed be the macro. | 1701 disk_cache::BackendImpl* backend_ = cache_impl_; // Needed be the macro. |
1702 | 1702 |
1703 for (int i = 1; i < 3; i++) { | 1703 for (int i = 1; i < 3; i++) { |
1704 CACHE_UMA(HOURS, "FillupTime", i, 28); | 1704 CACHE_UMA(HOURS, "FillupTime", i, 28); |
1705 } | 1705 } |
1706 } | 1706 } |
OLD | NEW |