OLD | NEW |
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 #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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/scoped_temp_dir.h" |
11 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
12 #include "net/base/cache_type.h" | 13 #include "net/base/cache_type.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 class IOBuffer; | 19 class IOBuffer; |
19 | 20 |
20 } // namespace net | 21 } // namespace net |
(...skipping 20 matching lines...) Expand all Loading... |
41 bool CopyTestCache(const std::string& name); | 42 bool CopyTestCache(const std::string& name); |
42 | 43 |
43 // Deletes the contents of |cache_path_|. | 44 // Deletes the contents of |cache_path_|. |
44 bool CleanupCacheDir(); | 45 bool CleanupCacheDir(); |
45 | 46 |
46 virtual void TearDown() OVERRIDE; | 47 virtual void TearDown() OVERRIDE; |
47 | 48 |
48 FilePath cache_path_; | 49 FilePath cache_path_; |
49 | 50 |
50 private: | 51 private: |
| 52 ScopedTempDir temp_dir_; |
51 scoped_ptr<MessageLoop> message_loop_; | 53 scoped_ptr<MessageLoop> message_loop_; |
52 }; | 54 }; |
53 | 55 |
54 // Provides basic support for cache related tests. | 56 // Provides basic support for cache related tests. |
55 class DiskCacheTestWithCache : public DiskCacheTest { | 57 class DiskCacheTestWithCache : public DiskCacheTest { |
56 protected: | 58 protected: |
57 DiskCacheTestWithCache(); | 59 DiskCacheTestWithCache(); |
58 virtual ~DiskCacheTestWithCache(); | 60 virtual ~DiskCacheTestWithCache(); |
59 | 61 |
60 void InitCache(); | 62 void InitCache(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 private: | 160 private: |
159 void InitMemoryCache(); | 161 void InitMemoryCache(); |
160 void InitDiskCache(); | 162 void InitDiskCache(); |
161 void InitDiskCacheImpl(); | 163 void InitDiskCacheImpl(); |
162 | 164 |
163 base::Thread cache_thread_; | 165 base::Thread cache_thread_; |
164 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 166 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
165 }; | 167 }; |
166 | 168 |
167 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 169 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
OLD | NEW |