OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/enhanced_bookmarks/image_store.h" | 5 #include "components/enhanced_bookmarks/image_store.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "components/enhanced_bookmarks/image_store_util.h" | 9 #include "components/enhanced_bookmarks/image_store_util.h" |
10 #include "components/enhanced_bookmarks/persistent_image_store.h" | 10 #include "components/enhanced_bookmarks/persistent_image_store.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 template <> bool ShouldPersist<TestImageStore>() { return false; } | 83 template <> bool ShouldPersist<TestImageStore>() { return false; } |
84 template <> bool ShouldPersist<PersistentImageStore>() { return true; } | 84 template <> bool ShouldPersist<PersistentImageStore>() { return true; } |
85 | 85 |
86 // Test fixture class template for the abstract API. | 86 // Test fixture class template for the abstract API. |
87 template <class T> | 87 template <class T> |
88 class ImageStoreUnitTest : public PlatformTest { | 88 class ImageStoreUnitTest : public PlatformTest { |
89 protected: | 89 protected: |
90 ImageStoreUnitTest() {} | 90 ImageStoreUnitTest() {} |
91 virtual ~ImageStoreUnitTest() {} | 91 virtual ~ImageStoreUnitTest() {} |
92 | 92 |
93 virtual void SetUp() OVERRIDE { | 93 virtual void SetUp() override { |
94 bool success = tempDir_.CreateUniqueTempDir(); | 94 bool success = tempDir_.CreateUniqueTempDir(); |
95 ASSERT_TRUE(success); | 95 ASSERT_TRUE(success); |
96 store_.reset(CreateStore<T>(tempDir_)); | 96 store_.reset(CreateStore<T>(tempDir_)); |
97 } | 97 } |
98 | 98 |
99 virtual void TearDown() OVERRIDE { | 99 virtual void TearDown() override { |
100 if (store_ && use_persistent_store()) | 100 if (store_ && use_persistent_store()) |
101 store_->ClearAll(); | 101 store_->ClearAll(); |
102 } | 102 } |
103 | 103 |
104 bool use_persistent_store() const { return ShouldPersist<T>(); } | 104 bool use_persistent_store() const { return ShouldPersist<T>(); } |
105 void ResetStore() { store_.reset(CreateStore<T>(tempDir_)); } | 105 void ResetStore() { store_.reset(CreateStore<T>(tempDir_)); } |
106 | 106 |
107 // The directory the database is saved into. | 107 // The directory the database is saved into. |
108 base::ScopedTempDir tempDir_; | 108 base::ScopedTempDir tempDir_; |
109 // The object the fixture is testing, via its base interface. | 109 // The object the fixture is testing, via its base interface. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if (this->use_persistent_store()) { | 247 if (this->use_persistent_store()) { |
248 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 90 * 1024); // 90kb | 248 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 90 * 1024); // 90kb |
249 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 200 * 1024); // 200kb | 249 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 200 * 1024); // 200kb |
250 } else { | 250 } else { |
251 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 400 * 1024); // 400kb | 251 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 400 * 1024); // 400kb |
252 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 500 * 1024); // 500kb | 252 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 500 * 1024); // 500kb |
253 } | 253 } |
254 } | 254 } |
255 | 255 |
256 } // namespace | 256 } // namespace |
OLD | NEW |