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

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

Issue 9949011: Make FileStream::Seek async and add FileStream::SeekSync for sync operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/base/upload_data.cc ('k') | net/http/http_cache_unittest.cc » ('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/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/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 TEST_F(DiskCacheEntryTest, MemoryOnlyDoomSparseEntry) { 1779 TEST_F(DiskCacheEntryTest, MemoryOnlyDoomSparseEntry) {
1780 SetMemoryOnlyMode(); 1780 SetMemoryOnlyMode();
1781 InitCache(); 1781 InitCache();
1782 DoomSparseEntry(); 1782 DoomSparseEntry();
1783 } 1783 }
1784 1784
1785 // A CompletionCallback wrapper that deletes the cache from within the callback. 1785 // A CompletionCallback wrapper that deletes the cache from within the callback.
1786 // The way an CompletionCallback works means that all tasks (even new ones) 1786 // The way an CompletionCallback works means that all tasks (even new ones)
1787 // are executed by the message loop before returning to the caller so the only 1787 // are executed by the message loop before returning to the caller so the only
1788 // way to simulate a race is to execute what we want on the callback. 1788 // way to simulate a race is to execute what we want on the callback.
1789 class SparseTestCompletionCallback: public TestCompletionCallbackBase { 1789 class SparseTestCompletionCallback: public net::TestCompletionCallbackBase {
1790 public: 1790 public:
1791 explicit SparseTestCompletionCallback(disk_cache::Backend* cache) 1791 explicit SparseTestCompletionCallback(disk_cache::Backend* cache)
1792 : cache_(cache), 1792 : cache_(cache),
1793 ALLOW_THIS_IN_INITIALIZER_LIST(callback_( 1793 ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
1794 base::Bind(&SparseTestCompletionCallback::OnComplete, 1794 base::Bind(&SparseTestCompletionCallback::OnComplete,
1795 base::Unretained(this)))) { 1795 base::Unretained(this)))) {
1796 } 1796 }
1797 1797
1798 const net::CompletionCallback& callback() const { return callback_; } 1798 const net::CompletionCallback& callback() const { return callback_; }
1799 1799
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 store->key_len = 800; 2061 store->key_len = 800;
2062 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size()); 2062 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size());
2063 entry_impl->entry()->set_modified(); 2063 entry_impl->entry()->set_modified();
2064 entry->Close(); 2064 entry->Close();
2065 2065
2066 // We have a corrupt entry. Now reload it. We should NOT read beyond the 2066 // We have a corrupt entry. Now reload it. We should NOT read beyond the
2067 // allocated buffer here. 2067 // allocated buffer here.
2068 ASSERT_NE(net::OK, OpenEntry(key, &entry)); 2068 ASSERT_NE(net::OK, OpenEntry(key, &entry));
2069 DisableIntegrityCheck(); 2069 DisableIntegrityCheck();
2070 } 2070 }
OLDNEW
« no previous file with comments | « net/base/upload_data.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698