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

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: get really explicit about sizes 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
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/file_util.h" 6 #include "base/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 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after
3509 std::set<std::string> keys_to_match(key_pool); 3509 std::set<std::string> keys_to_match(key_pool);
3510 void* iter = NULL; 3510 void* iter = NULL;
3511 size_t count = 0; 3511 size_t count = 0;
3512 ASSERT_TRUE(EnumerateAndMatchKeys(-1, &iter, &keys_to_match, &count)); 3512 ASSERT_TRUE(EnumerateAndMatchKeys(-1, &iter, &keys_to_match, &count));
3513 cache_->EndEnumeration(&iter); 3513 cache_->EndEnumeration(&iter);
3514 3514
3515 EXPECT_EQ(key_pool.size(), count); 3515 EXPECT_EQ(key_pool.size(), count);
3516 EXPECT_TRUE(keys_to_match.empty()); 3516 EXPECT_TRUE(keys_to_match.empty());
3517 } 3517 }
3518 3518
3519 // Tests that enumerations don't leak memory when the backend is destructed
3520 // mid-enumeration.
3521 TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationDestruction) {
3522 SetSimpleCacheMode();
3523 InitCache();
3524 std::set<std::string> key_pool;
3525 ASSERT_TRUE(CreateSetOfRandomEntries(&key_pool));
3526
3527 void* iter = NULL;
3528 disk_cache::Entry* entry = NULL;
3529 ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry));
3530 EXPECT_TRUE(entry);
3531 disk_cache::ScopedEntryPtr entry_closer(entry);
3532
3533 cache_.reset();
3534 // This test passes if we don't leak memory.
3535 }
3536
3519 #endif // defined(OS_POSIX) 3537 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.h » ('j') | net/disk_cache/simple/simple_backend_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698