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

Side by Side Diff: net/disk_cache/backend_unittest.cc

Issue 533293002: Delete enumerations at Simple Cache backend deletion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint Created 6 years, 3 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
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/port.h" 8 #include "base/port.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3466 std::set<std::string> keys_to_match(key_pool); 3466 std::set<std::string> keys_to_match(key_pool);
3467 void* iter = NULL; 3467 void* iter = NULL;
3468 size_t count = 0; 3468 size_t count = 0;
3469 ASSERT_TRUE(EnumerateAndMatchKeys(-1, &iter, &keys_to_match, &count)); 3469 ASSERT_TRUE(EnumerateAndMatchKeys(-1, &iter, &keys_to_match, &count));
3470 cache_->EndEnumeration(&iter); 3470 cache_->EndEnumeration(&iter);
3471 3471
3472 EXPECT_EQ(key_pool.size(), count); 3472 EXPECT_EQ(key_pool.size(), count);
3473 EXPECT_TRUE(keys_to_match.empty()); 3473 EXPECT_TRUE(keys_to_match.empty());
3474 } 3474 }
3475 3475
3476 // Tests that enumerations don't leak memory when the backend is destructed
3477 // mid-enumeration.
3478 TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationDestruction) {
3479 SetSimpleCacheMode();
3480 InitCache();
3481 std::set<std::string> key_pool;
3482 ASSERT_TRUE(CreateSetOfRandomEntries(&key_pool));
3483
3484 void* iter = NULL;
3485 disk_cache::Entry* entry = NULL;
3486 ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry));
3487 EXPECT_TRUE(entry);
3488 disk_cache::ScopedEntryPtr entry_closer(entry);
3489
3490 cache_.reset();
3491 // This test passes if we don't leak memory.
3492 }
3493
3476 #endif // defined(OS_POSIX) 3494 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698