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

Side by Side Diff: net/disk_cache/disk_cache_test_base.h

Issue 2739007: Disk cache: Update the disk cache tools and tests to use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_base.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) 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 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/time.h" 9 #include "base/thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 12
13 class FilePath; 13 class FilePath;
14 14
15 namespace disk_cache { 15 namespace disk_cache {
16 16
17 class Backend; 17 class Backend;
18 class BackendImpl; 18 class BackendImpl;
19 class Entry; 19 class Entry;
20 class MemBackendImpl; 20 class MemBackendImpl;
21 21
22 } // namespace disk_cache 22 } // namespace disk_cache
23 23
24 // These tests can use the path service, which uses autoreleased objects on the 24 // These tests can use the path service, which uses autoreleased objects on the
25 // Mac, so this needs to be a PlatformTest. Even tests that do not require a 25 // Mac, so this needs to be a PlatformTest. Even tests that do not require a
26 // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible 26 // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible
27 // to this problem; all such tests should use TEST_F(DiskCacheTest, ...). 27 // to this problem; all such tests should use TEST_F(DiskCacheTest, ...).
28 class DiskCacheTest : public PlatformTest { 28 class DiskCacheTest : public PlatformTest {
29 virtual void TearDown(); 29 virtual void TearDown();
30 }; 30 };
31 31
32 // Provides basic support for cache related tests. 32 // Provides basic support for cache related tests.
33 class DiskCacheTestWithCache : public DiskCacheTest { 33 class DiskCacheTestWithCache : public DiskCacheTest {
34 protected: 34 protected:
35 DiskCacheTestWithCache() 35 DiskCacheTestWithCache()
36 : cache_(NULL), cache_impl_(NULL), mem_cache_(NULL), mask_(0), size_(0), 36 : cache_(NULL), cache_impl_(NULL), mem_cache_(NULL), mask_(0), size_(0),
37 memory_only_(false), implementation_(false), force_creation_(false), 37 memory_only_(false), implementation_(false), force_creation_(false),
38 new_eviction_(false), first_cleanup_(true), integrity_(true) {} 38 new_eviction_(false), first_cleanup_(true), integrity_(true),
39 cache_thread_("CacheThread") {}
39 40
40 void InitCache(); 41 void InitCache();
41 virtual void TearDown(); 42 virtual void TearDown();
42 void SimulateCrash(); 43 void SimulateCrash();
43 void SetTestMode(); 44 void SetTestMode();
44 45
45 void SetMemoryOnlyMode() { 46 void SetMemoryOnlyMode() {
46 memory_only_ = true; 47 memory_only_ = true;
47 } 48 }
48 49
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool new_eviction_; 99 bool new_eviction_;
99 bool first_cleanup_; 100 bool first_cleanup_;
100 bool integrity_; 101 bool integrity_;
101 // This is intentionally left uninitialized, to be used by any test. 102 // This is intentionally left uninitialized, to be used by any test.
102 bool success_; 103 bool success_;
103 104
104 private: 105 private:
105 void InitMemoryCache(); 106 void InitMemoryCache();
106 void InitDiskCache(); 107 void InitDiskCache();
107 void InitDiskCacheImpl(const FilePath& path); 108 void InitDiskCacheImpl(const FilePath& path);
109
110 base::Thread cache_thread_;
111 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache);
108 }; 112 };
109 113
110 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 114 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698