| Index: components/enhanced_bookmarks/image_store_ios_unittest.mm
|
| diff --git a/components/enhanced_bookmarks/image_store_ios_unittest.mm b/components/enhanced_bookmarks/image_store_ios_unittest.mm
|
| index 78c57cb9ffdaeca137b40db6d162f8dd33900bc1..19dd5fae2b5119943d6c5da7682556d00248fc7f 100644
|
| --- a/components/enhanced_bookmarks/image_store_ios_unittest.mm
|
| +++ b/components/enhanced_bookmarks/image_store_ios_unittest.mm
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/files/scoped_temp_dir.h"
|
| #include "base/mac/scoped_cftyperef.h"
|
| +#include "components/enhanced_bookmarks/image_record.h"
|
| #include "components/enhanced_bookmarks/image_store_util.h"
|
| #include "components/enhanced_bookmarks/persistent_image_store.h"
|
| #include "components/enhanced_bookmarks/test_image_store.h"
|
| @@ -21,7 +22,7 @@ namespace {
|
| // Generates a gfx::Image with a random UIImage representation. Uses off-center
|
| // circle gradient to make all pixels slightly different in order to detect
|
| // small image alterations.
|
| -gfx::Image GenerateRandomUIImage(gfx::Size& size, float scale) {
|
| +gfx::Image GenerateRandomUIImage(const gfx::Size& size, float scale) {
|
| UIGraphicsBeginImageContextWithOptions(CGSizeMake(size.width(),
|
| size.height()),
|
| YES, // opaque.
|
| @@ -136,17 +137,19 @@ typedef testing::Types<TestImageStore,
|
| TYPED_TEST_CASE(ImageStoreUnitTestIOS, Implementations);
|
|
|
| TYPED_TEST(ImageStoreUnitTestIOS, StoringImagesPreservesScale) {
|
| - CGFloat scales[] = { 0.0, 1.0, 2.0 };
|
| - gfx::Size image_size(42, 24);
|
| + const CGFloat scales[] = {0.0, 1.0, 2.0};
|
| + const gfx::Size image_size(42, 24);
|
| for (unsigned long i = 0; i < arraysize(scales); i++) {
|
| - gfx::Image src_image(GenerateRandomUIImage(image_size, scales[i]));
|
| const GURL url("foo://bar");
|
| - const GURL image_url("a.jpg");
|
| - this->store_->Insert(url, image_url, src_image);
|
| - std::pair<gfx::Image, GURL> image_info = this->store_->Get(url);
|
| -
|
| - EXPECT_EQ(image_url, image_info.second);
|
| - EXPECT_TRUE(CompareImages(src_image, image_info.first));
|
| + const enhanced_bookmarks::ImageRecord image_in(
|
| + GenerateRandomUIImage(image_size, scales[i]), GURL("http://a.jpg"),
|
| + SK_ColorGREEN);
|
| + this->store_->Insert(url, image_in);
|
| + const enhanced_bookmarks::ImageRecord image_out = this->store_->Get(url);
|
| +
|
| + EXPECT_EQ(image_in.url, image_out.url);
|
| + EXPECT_TRUE(CompareImages(image_in.image, image_out.image));
|
| + EXPECT_EQ(image_in.dominant_color, image_out.dominant_color);
|
| }
|
| }
|
|
|
|
|