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

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

Issue 651063002: Deflake Simple Cache backend on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add index file Created 6 years, 1 month 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/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size()); 2324 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size());
2325 entry_impl->entry()->set_modified(); 2325 entry_impl->entry()->set_modified();
2326 entry->Close(); 2326 entry->Close();
2327 2327
2328 // We have a corrupt entry. Now reload it. We should NOT read beyond the 2328 // We have a corrupt entry. Now reload it. We should NOT read beyond the
2329 // allocated buffer here. 2329 // allocated buffer here.
2330 ASSERT_NE(net::OK, OpenEntry(key, &entry)); 2330 ASSERT_NE(net::OK, OpenEntry(key, &entry));
2331 DisableIntegrityCheck(); 2331 DisableIntegrityCheck();
2332 } 2332 }
2333 2333
2334 // The Simple Cache backend requires a few guarantees from the filesystem like
2335 // atomic renaming of recently open files. Those guarantees are not provided in
2336 // general on Windows.
2337 #if defined(OS_POSIX)
2338
2339 TEST_F(DiskCacheEntryTest, SimpleCacheInternalAsyncIO) { 2334 TEST_F(DiskCacheEntryTest, SimpleCacheInternalAsyncIO) {
2340 SetSimpleCacheMode(); 2335 SetSimpleCacheMode();
2341 InitCache(); 2336 InitCache();
2342 InternalAsyncIO(); 2337 InternalAsyncIO();
2343 } 2338 }
2344 2339
2345 TEST_F(DiskCacheEntryTest, SimpleCacheExternalAsyncIO) { 2340 TEST_F(DiskCacheEntryTest, SimpleCacheExternalAsyncIO) {
2346 SetSimpleCacheMode(); 2341 SetSimpleCacheMode();
2347 InitCache(); 2342 InitCache();
2348 ExternalAsyncIO(); 2343 ExternalAsyncIO();
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after
4056 4051
4057 ret = entry->ReadSparseData(kSize, buffer.get(), kSize, callback.callback()); 4052 ret = entry->ReadSparseData(kSize, buffer.get(), kSize, callback.callback());
4058 EXPECT_EQ(kSize, callback.GetResult(ret)); 4053 EXPECT_EQ(kSize, callback.GetResult(ret));
4059 4054
4060 // Make sure the first range was removed when the second was written. 4055 // Make sure the first range was removed when the second was written.
4061 ret = entry->ReadSparseData(0, buffer.get(), kSize, callback.callback()); 4056 ret = entry->ReadSparseData(0, buffer.get(), kSize, callback.callback());
4062 EXPECT_EQ(0, callback.GetResult(ret)); 4057 EXPECT_EQ(0, callback.GetResult(ret));
4063 4058
4064 entry->Close(); 4059 entry->Close();
4065 } 4060 }
4066
4067 #endif // defined(OS_POSIX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698