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

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

Issue 2289133003: Disables flaky test DiskCacheBackendTest.SimpleCacheEnumerationCorruption (Closed)
Patch Set: Created 4 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 | no next file » | 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 DoomEntry(key_to_delete); 3746 DoomEntry(key_to_delete);
3747 keys_to_match.erase(key_to_delete); 3747 keys_to_match.erase(key_to_delete);
3748 key_pool.erase(key_to_delete); 3748 key_pool.erase(key_to_delete);
3749 ASSERT_TRUE(EnumerateAndMatchKeys(-1, iter.get(), &keys_to_match, &count)); 3749 ASSERT_TRUE(EnumerateAndMatchKeys(-1, iter.get(), &keys_to_match, &count));
3750 iter.reset(); 3750 iter.reset();
3751 3751
3752 EXPECT_EQ(key_pool.size(), count); 3752 EXPECT_EQ(key_pool.size(), count);
3753 EXPECT_TRUE(keys_to_match.empty()); 3753 EXPECT_TRUE(keys_to_match.empty());
3754 } 3754 }
3755 3755
3756 // This test is flaky on Android Marshmallow crbug.com/638891.
3757 #if !defined(OS_ANDROID)
3756 // Tests that enumerations are not affected by corrupt files. 3758 // Tests that enumerations are not affected by corrupt files.
3757 TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationCorruption) { 3759 TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationCorruption) {
3758 SetSimpleCacheMode(); 3760 SetSimpleCacheMode();
3759 InitCache(); 3761 InitCache();
3760 // Create a corrupt entry. The write/read sequence ensures that the entry will 3762 // Create a corrupt entry. The write/read sequence ensures that the entry will
3761 // have been created before corrupting the platform files, in the case of 3763 // have been created before corrupting the platform files, in the case of
3762 // optimistic operations. 3764 // optimistic operations.
3763 const std::string key = "the key"; 3765 const std::string key = "the key";
3764 disk_cache::Entry* corrupted_entry; 3766 disk_cache::Entry* corrupted_entry;
3765 3767
(...skipping 17 matching lines...) Expand all
3783 // Check that enumeration returns all entries but the corrupt one. 3785 // Check that enumeration returns all entries but the corrupt one.
3784 std::set<std::string> keys_to_match(key_pool); 3786 std::set<std::string> keys_to_match(key_pool);
3785 std::unique_ptr<TestIterator> iter = CreateIterator(); 3787 std::unique_ptr<TestIterator> iter = CreateIterator();
3786 size_t count = 0; 3788 size_t count = 0;
3787 ASSERT_TRUE(EnumerateAndMatchKeys(-1, iter.get(), &keys_to_match, &count)); 3789 ASSERT_TRUE(EnumerateAndMatchKeys(-1, iter.get(), &keys_to_match, &count));
3788 iter.reset(); 3790 iter.reset();
3789 3791
3790 EXPECT_EQ(key_pool.size(), count); 3792 EXPECT_EQ(key_pool.size(), count);
3791 EXPECT_TRUE(keys_to_match.empty()); 3793 EXPECT_TRUE(keys_to_match.empty());
3792 } 3794 }
3795 #endif
3793 3796
3794 // Tests that enumerations don't leak memory when the backend is destructed 3797 // Tests that enumerations don't leak memory when the backend is destructed
3795 // mid-enumeration. 3798 // mid-enumeration.
3796 TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationDestruction) { 3799 TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationDestruction) {
3797 SetSimpleCacheMode(); 3800 SetSimpleCacheMode();
3798 InitCache(); 3801 InitCache();
3799 std::set<std::string> key_pool; 3802 std::set<std::string> key_pool;
3800 ASSERT_TRUE(CreateSetOfRandomEntries(&key_pool)); 3803 ASSERT_TRUE(CreateSetOfRandomEntries(&key_pool));
3801 3804
3802 std::unique_ptr<TestIterator> iter = CreateIterator(); 3805 std::unique_ptr<TestIterator> iter = CreateIterator();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3866 // because that would advance the cache directory mtime and invalidate the 3869 // because that would advance the cache directory mtime and invalidate the
3867 // index. 3870 // index.
3868 entry2->Doom(); 3871 entry2->Doom();
3869 entry2->Close(); 3872 entry2->Close();
3870 3873
3871 DisableFirstCleanup(); 3874 DisableFirstCleanup();
3872 InitCache(); 3875 InitCache();
3873 EXPECT_EQ(disk_cache::SimpleIndex::INITIALIZE_METHOD_LOADED, 3876 EXPECT_EQ(disk_cache::SimpleIndex::INITIALIZE_METHOD_LOADED,
3874 simple_cache_impl_->index()->init_method()); 3877 simple_cache_impl_->index()->init_method());
3875 } 3878 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698