OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/mru_cache.h" | 6 #include "content/common/mru_cache.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 int cached_item_live_count = 0; | 11 int cached_item_live_count = 0; |
12 | 12 |
13 struct CachedItem { | 13 struct CachedItem { |
14 CachedItem() : value(0) { | 14 CachedItem() : value(0) { |
15 cached_item_live_count++; | 15 cached_item_live_count++; |
16 } | 16 } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 cache.Put(kItem4Key, new CachedItem(23)); | 244 cache.Put(kItem4Key, new CachedItem(23)); |
245 | 245 |
246 // The cache should only have kMaxSize items in it even though we inserted | 246 // The cache should only have kMaxSize items in it even though we inserted |
247 // more. | 247 // more. |
248 EXPECT_EQ(kMaxSize, cache.size()); | 248 EXPECT_EQ(kMaxSize, cache.size()); |
249 } | 249 } |
250 | 250 |
251 // There should be no objects leaked. | 251 // There should be no objects leaked. |
252 EXPECT_EQ(initial_count, cached_item_live_count); | 252 EXPECT_EQ(initial_count, cached_item_live_count); |
253 } | 253 } |
OLD | NEW |