| Index: components/wallpaper/wallpaper_color_calculator_unittest.cc
|
| diff --git a/components/wallpaper/wallpaper_color_calculator_unittest.cc b/components/wallpaper/wallpaper_color_calculator_unittest.cc
|
| index 595f5c06b57272812665fa137718eb88e060ae18..da1f1ccfbc45aa814aceff54134aaae849124d1c 100644
|
| --- a/components/wallpaper/wallpaper_color_calculator_unittest.cc
|
| +++ b/components/wallpaper/wallpaper_color_calculator_unittest.cc
|
| @@ -59,9 +59,8 @@ class TestWallpaperColorCalculatorObserver
|
| DISALLOW_COPY_AND_ASSIGN(TestWallpaperColorCalculatorObserver);
|
| };
|
|
|
| -// Returns an image that will yield a color when processing it with
|
| -// color_utils::CalculateProminentColorOfBitmap() using the LumaRange::NORMAL
|
| -// and SaturationRange::VIBRANT values.
|
| +// Returns an image that will yield a color using the LumaRange::NORMAL and
|
| +// SaturationRange::VIBRANT values.
|
| gfx::ImageSkia CreateColorProducingImage(const gfx::Size& size) {
|
| gfx::Canvas canvas(size, 1.0f, true);
|
| canvas.DrawColor(kGray);
|
| @@ -69,8 +68,8 @@ gfx::ImageSkia CreateColorProducingImage(const gfx::Size& size) {
|
| return gfx::ImageSkia::CreateFrom1xBitmap(canvas.GetBitmap());
|
| }
|
|
|
| -// Returns an image that will not yield a color when processing it with
|
| -// color_utils::CalculateProminentColorOfBitmap().
|
| +// Returns an image that will not yield a color using the LumaRange::NORMAL and
|
| +// SaturationRange::VIBRANT values.
|
| gfx::ImageSkia CreateNonColorProducingImage(const gfx::Size& size) {
|
| gfx::Canvas canvas(size, 1.0f, true);
|
| canvas.DrawColor(kGray);
|
| @@ -129,14 +128,16 @@ void WallPaperColorCalculatorTest::InstallTaskRunner(
|
|
|
| void WallPaperColorCalculatorTest::CreateCalculator(
|
| const gfx::ImageSkia& image) {
|
| + color_utils::ColorProfiles color_profiles;
|
| + color_profiles.push_back(color_utils::ColorProfile(
|
| + color_utils::LumaRange::NORMAL, color_utils::SaturationRange::VIBRANT));
|
| calculator_ = base::MakeUnique<WallpaperColorCalculator>(
|
| - image, color_utils::LumaRange::NORMAL,
|
| - color_utils::SaturationRange::VIBRANT, task_runner_);
|
| + image, color_profiles, task_runner_);
|
| calculator_->AddObserver(&observer_);
|
| }
|
|
|
| // Used to group the asynchronous calculation tests.
|
| -typedef WallPaperColorCalculatorTest WallPaperColorCalculatorAsyncTest;
|
| +using WallPaperColorCalculatorAsyncTest = WallPaperColorCalculatorTest;
|
|
|
| TEST_F(WallPaperColorCalculatorAsyncTest, MetricsForSuccessfulExtraction) {
|
| histograms_.ExpectTotalCount("Ash.Wallpaper.ColorExtractionResult", 0);
|
| @@ -167,7 +168,7 @@ TEST_F(WallPaperColorCalculatorAsyncTest, MetricsWhenPostingTaskFails) {
|
| histograms_.ExpectTotalCount("Ash.Wallpaper.ColorExtraction.Durations", 0);
|
| histograms_.ExpectTotalCount("Ash.Wallpaper.ColorExtraction.UserDelay", 0);
|
|
|
| - EXPECT_EQ(kDefaultColor, calculator_->prominent_color());
|
| + EXPECT_EQ(kDefaultColor, calculator_->prominent_colors()[0]);
|
| }
|
|
|
| TEST_F(WallPaperColorCalculatorAsyncTest,
|
| @@ -182,13 +183,14 @@ TEST_F(WallPaperColorCalculatorAsyncTest,
|
| }
|
|
|
| TEST_F(WallPaperColorCalculatorAsyncTest, ColorUpdatedOnSuccessfulCalculation) {
|
| - calculator_->set_prominent_color_for_test(kDefaultColor);
|
| + std::vector<SkColor> colors = {kDefaultColor};
|
| + calculator_->set_prominent_colors_for_test(colors);
|
|
|
| EXPECT_TRUE(calculator_->StartCalculation());
|
| - EXPECT_EQ(kDefaultColor, calculator_->prominent_color());
|
| + EXPECT_EQ(kDefaultColor, calculator_->prominent_colors()[0]);
|
|
|
| task_runner_->RunUntilIdle();
|
| - EXPECT_NE(kDefaultColor, calculator_->prominent_color());
|
| + EXPECT_NE(kDefaultColor, calculator_->prominent_colors()[0]);
|
| }
|
|
|
| TEST_F(WallPaperColorCalculatorAsyncTest,
|
| @@ -204,7 +206,7 @@ TEST_F(WallPaperColorCalculatorAsyncTest,
|
| }
|
|
|
| // Used to group the synchronous calculation tests.
|
| -typedef WallPaperColorCalculatorTest WallPaperColorCalculatorSyncTest;
|
| +using WallPaperColorCalculatorSyncTest = WallPaperColorCalculatorTest;
|
|
|
| TEST_F(WallPaperColorCalculatorSyncTest, MetricsForSuccessfulExtraction) {
|
| CreateCalculator(CreateColorProducingImage(kSyncImageSize));
|
|
|