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

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

Issue 477973002: Add Keys() function to ServiceWorkerCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache_patch
Patch Set: Address comments from PS11 and enable SimpleCache everywhere 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/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 2442
2443 TEST_F(DiskCacheEntryTest, SimpleCacheInvalidData) { 2443 TEST_F(DiskCacheEntryTest, SimpleCacheInvalidData) {
2444 SetSimpleCacheMode(); 2444 SetSimpleCacheMode();
2445 InitCache(); 2445 InitCache();
2446 for (int i = 0; i < disk_cache::kSimpleEntryStreamCount; ++i) { 2446 for (int i = 0; i < disk_cache::kSimpleEntryStreamCount; ++i) {
2447 EXPECT_EQ(net::OK, DoomAllEntries()); 2447 EXPECT_EQ(net::OK, DoomAllEntries());
2448 InvalidData(i); 2448 InvalidData(i);
2449 } 2449 }
2450 } 2450 }
2451 2451
2452 TEST_F(DiskCacheEntryTest, SimpleCacheReadWriteDestroyBuffer) { 2452 TEST_F(DiskCacheEntryTest, SimpleCacheReadOriteDestroyBuffer) {
michaeln 2014/08/29 20:08:26 typo?
jkarlin 2014/09/02 11:31:37 Done.
2453 // Proving that the test works well with optimistic operations enabled is 2453 // Proving that the test works well with optimistic operations enabled is
2454 // subtle, instead run only in APP_CACHE mode to disable optimistic 2454 // subtle, instead run only in APP_CACHE mode to disable optimistic
2455 // operations. Stream 0 always uses optimistic operations, so the test is not 2455 // operations. Stream 0 always uses optimistic operations, so the test is not
2456 // run on stream 0. 2456 // run on stream 0.
2457 SetCacheType(net::APP_CACHE); 2457 SetCacheType(net::APP_CACHE);
2458 SetSimpleCacheMode(); 2458 SetSimpleCacheMode();
2459 InitCache(); 2459 InitCache();
2460 for (int i = 1; i < disk_cache::kSimpleEntryStreamCount; ++i) { 2460 for (int i = 1; i < disk_cache::kSimpleEntryStreamCount; ++i) {
2461 EXPECT_EQ(net::OK, DoomAllEntries()); 2461 EXPECT_EQ(net::OK, DoomAllEntries());
2462 ReadWriteDestroyBuffer(i); 2462 ReadWriteDestroyBuffer(i);
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 EXPECT_EQ(kSize, callback.GetResult(ret)); 3994 EXPECT_EQ(kSize, callback.GetResult(ret));
3995 3995
3996 // Make sure the first range was removed when the second was written. 3996 // Make sure the first range was removed when the second was written.
3997 ret = entry->ReadSparseData(0, buffer.get(), kSize, callback.callback()); 3997 ret = entry->ReadSparseData(0, buffer.get(), kSize, callback.callback());
3998 EXPECT_EQ(0, callback.GetResult(ret)); 3998 EXPECT_EQ(0, callback.GetResult(ret));
3999 3999
4000 entry->Close(); 4000 entry->Close();
4001 } 4001 }
4002 4002
4003 #endif // defined(OS_POSIX) 4003 #endif // defined(OS_POSIX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698