Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: components/enhanced_bookmarks/image_store_ios_unittest.mm

Issue 875463003: ★ Record the image dominant color in the image database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/enhanced_bookmarks/image_store.cc ('k') | components/enhanced_bookmarks/image_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « components/enhanced_bookmarks/image_store.cc ('k') | components/enhanced_bookmarks/image_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698