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/disk_cache_test_base.h

Issue 3167020: Disk cache: Extend the internal buffering performed by each entry... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 5 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
6 #define NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 6 #define NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
13 13
14 class FilePath; 14 class FilePath;
15 15
16 namespace net {
17
18 class IOBuffer;
19
20 } // namespace net
21
16 namespace disk_cache { 22 namespace disk_cache {
17 23
18 class Backend; 24 class Backend;
19 class BackendImpl; 25 class BackendImpl;
20 class Entry; 26 class Entry;
21 class MemBackendImpl; 27 class MemBackendImpl;
22 28
23 } // namespace disk_cache 29 } // namespace disk_cache
24 30
25 // These tests can use the path service, which uses autoreleased objects on the 31 // These tests can use the path service, which uses autoreleased objects on the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Utility methods to access the cache and wait for each operation to finish. 89 // Utility methods to access the cache and wait for each operation to finish.
84 int OpenEntry(const std::string& key, disk_cache::Entry** entry); 90 int OpenEntry(const std::string& key, disk_cache::Entry** entry);
85 int CreateEntry(const std::string& key, disk_cache::Entry** entry); 91 int CreateEntry(const std::string& key, disk_cache::Entry** entry);
86 int DoomEntry(const std::string& key); 92 int DoomEntry(const std::string& key);
87 int DoomAllEntries(); 93 int DoomAllEntries();
88 int DoomEntriesBetween(const base::Time initial_time, 94 int DoomEntriesBetween(const base::Time initial_time,
89 const base::Time end_time); 95 const base::Time end_time);
90 int DoomEntriesSince(const base::Time initial_time); 96 int DoomEntriesSince(const base::Time initial_time);
91 int OpenNextEntry(void** iter, disk_cache::Entry** next_entry); 97 int OpenNextEntry(void** iter, disk_cache::Entry** next_entry);
92 void FlushQueueForTest(); 98 void FlushQueueForTest();
99 int ReadData(disk_cache::Entry* entry, int index, int offset,
100 net::IOBuffer* buf, int len);
101 int WriteData(disk_cache::Entry* entry, int index, int offset,
102 net::IOBuffer* buf, int len, bool truncate);
103 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf,
104 int len);
105 int WriteSparseData(disk_cache::Entry* entry, int64 offset,
106 net::IOBuffer* buf, int len);
93 107
94 // cache_ will always have a valid object, regardless of how the cache was 108 // cache_ will always have a valid object, regardless of how the cache was
95 // initialized. The implementation pointers can be NULL. 109 // initialized. The implementation pointers can be NULL.
96 disk_cache::Backend* cache_; 110 disk_cache::Backend* cache_;
97 disk_cache::BackendImpl* cache_impl_; 111 disk_cache::BackendImpl* cache_impl_;
98 disk_cache::MemBackendImpl* mem_cache_; 112 disk_cache::MemBackendImpl* mem_cache_;
99 113
100 uint32 mask_; 114 uint32 mask_;
101 int size_; 115 int size_;
102 bool memory_only_; 116 bool memory_only_;
103 bool implementation_; 117 bool implementation_;
104 bool force_creation_; 118 bool force_creation_;
105 bool new_eviction_; 119 bool new_eviction_;
106 bool first_cleanup_; 120 bool first_cleanup_;
107 bool integrity_; 121 bool integrity_;
108 bool use_current_thread_; 122 bool use_current_thread_;
109 // This is intentionally left uninitialized, to be used by any test. 123 // This is intentionally left uninitialized, to be used by any test.
110 bool success_; 124 bool success_;
111 125
112 private: 126 private:
113 void InitMemoryCache(); 127 void InitMemoryCache();
114 void InitDiskCache(); 128 void InitDiskCache();
115 void InitDiskCacheImpl(const FilePath& path); 129 void InitDiskCacheImpl(const FilePath& path);
116 130
117 base::Thread cache_thread_; 131 base::Thread cache_thread_;
118 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); 132 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache);
119 }; 133 };
120 134
121 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 135 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698