| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/platform_test.h" | 9 #include "base/platform_test.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 // These tests can use the path service, which uses autoreleased objects on the | |
| 13 // Mac, so this needs to be a PlatformTest. Even tests that do not require a | |
| 14 // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible | |
| 15 // to this problem; all such tests should use TEST_F(DiskCacheTest, ...). | |
| 16 typedef PlatformTest DiskCacheTest; | |
| 17 | |
| 18 namespace disk_cache { | 12 namespace disk_cache { |
| 19 | 13 |
| 20 class Backend; | 14 class Backend; |
| 21 class BackendImpl; | 15 class BackendImpl; |
| 22 class MemBackendImpl; | 16 class MemBackendImpl; |
| 23 | 17 |
| 24 } // namespace disk_cache | 18 } // namespace disk_cache |
| 25 | 19 |
| 20 // These tests can use the path service, which uses autoreleased objects on the |
| 21 // Mac, so this needs to be a PlatformTest. Even tests that do not require a |
| 22 // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible |
| 23 // to this problem; all such tests should use TEST_F(DiskCacheTest, ...). |
| 24 class DiskCacheTest : public PlatformTest { |
| 25 virtual void TearDown(); |
| 26 }; |
| 27 |
| 26 // Provides basic support for cache related tests. | 28 // Provides basic support for cache related tests. |
| 27 class DiskCacheTestWithCache : public DiskCacheTest { | 29 class DiskCacheTestWithCache : public DiskCacheTest { |
| 28 protected: | 30 protected: |
| 29 DiskCacheTestWithCache() | 31 DiskCacheTestWithCache() |
| 30 : cache_(NULL), cache_impl_(NULL), mem_cache_(NULL), mask_(0), size_(0), | 32 : cache_(NULL), cache_impl_(NULL), mem_cache_(NULL), mask_(0), size_(0), |
| 31 memory_only_(false), implementation_(false), force_creation_(false), | 33 memory_only_(false), implementation_(false), force_creation_(false), |
| 32 first_cleanup_(true) {} | 34 first_cleanup_(true) {} |
| 33 | 35 |
| 34 void InitCache(); | 36 void InitCache(); |
| 35 virtual void TearDown(); | 37 virtual void TearDown(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bool implementation_; | 74 bool implementation_; |
| 73 bool force_creation_; | 75 bool force_creation_; |
| 74 bool first_cleanup_; | 76 bool first_cleanup_; |
| 75 | 77 |
| 76 private: | 78 private: |
| 77 void InitMemoryCache(); | 79 void InitMemoryCache(); |
| 78 void InitDiskCache(); | 80 void InitDiskCache(); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 83 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
| OLD | NEW |