| 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 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 template <> bool ShouldPersist<TestImageStore>() { return false; } | 99 template <> bool ShouldPersist<TestImageStore>() { return false; } |
| 100 template <> bool ShouldPersist<PersistentImageStore>() { return true; } | 100 template <> bool ShouldPersist<PersistentImageStore>() { return true; } |
| 101 | 101 |
| 102 // Test fixture class template for the abstract API. | 102 // Test fixture class template for the abstract API. |
| 103 template <class T> | 103 template <class T> |
| 104 class ImageStoreUnitTestIOS : public PlatformTest { | 104 class ImageStoreUnitTestIOS : public PlatformTest { |
| 105 protected: | 105 protected: |
| 106 ImageStoreUnitTestIOS() {} | 106 ImageStoreUnitTestIOS() {} |
| 107 virtual ~ImageStoreUnitTestIOS() {} | 107 virtual ~ImageStoreUnitTestIOS() {} |
| 108 | 108 |
| 109 virtual void SetUp() OVERRIDE { | 109 virtual void SetUp() override { |
| 110 bool success = temp_dir_.CreateUniqueTempDir(); | 110 bool success = temp_dir_.CreateUniqueTempDir(); |
| 111 ASSERT_TRUE(success); | 111 ASSERT_TRUE(success); |
| 112 store_.reset(CreateStore<T>(temp_dir_)); | 112 store_.reset(CreateStore<T>(temp_dir_)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void TearDown() OVERRIDE { | 115 virtual void TearDown() override { |
| 116 if (store_ && use_persistent_store()) | 116 if (store_ && use_persistent_store()) |
| 117 store_->ClearAll(); | 117 store_->ClearAll(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool use_persistent_store() const { return ShouldPersist<T>(); } | 120 bool use_persistent_store() const { return ShouldPersist<T>(); } |
| 121 void ResetStore() { store_.reset(CreateStore<T>(temp_dir_)); } | 121 void ResetStore() { store_.reset(CreateStore<T>(temp_dir_)); } |
| 122 | 122 |
| 123 // The directory the database is saved into. | 123 // The directory the database is saved into. |
| 124 base::ScopedTempDir temp_dir_; | 124 base::ScopedTempDir temp_dir_; |
| 125 // The object the fixture is testing, via its base interface. | 125 // The object the fixture is testing, via its base interface. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 144 const GURL image_url("a.jpg"); | 144 const GURL image_url("a.jpg"); |
| 145 this->store_->Insert(url, image_url, src_image); | 145 this->store_->Insert(url, image_url, src_image); |
| 146 std::pair<gfx::Image, GURL> image_info = this->store_->Get(url); | 146 std::pair<gfx::Image, GURL> image_info = this->store_->Get(url); |
| 147 | 147 |
| 148 EXPECT_EQ(image_url, image_info.second); | 148 EXPECT_EQ(image_url, image_info.second); |
| 149 EXPECT_TRUE(CompareImages(src_image, image_info.first)); | 149 EXPECT_TRUE(CompareImages(src_image, image_info.first)); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| OLD | NEW |