| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_icon_image.h" | 5 #include "chrome/browser/extensions/extension_icon_image.h" |
| 6 | 6 |
| 7 #include "base/json/json_file_value_serializer.h" | 7 #include "base/json/json_file_value_serializer.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/browser/extensions/image_loader.h" | 10 #include "chrome/browser/extensions/image_loader.h" |
| 11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 #include "chrome/common/extensions/extension_constants.h" | 13 #include "chrome/common/extensions/extension_constants.h" |
| 14 #include "chrome/common/extensions/manifest.h" |
| 14 #include "content/public/test/test_browser_thread.h" | 15 #include "content/public/test/test_browser_thread.h" |
| 15 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
| 16 #include "skia/ext/image_operations.h" | 17 #include "skia/ext/image_operations.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/image/image_skia_source.h" | 20 #include "ui/gfx/image/image_skia_source.h" |
| 20 #include "ui/gfx/skia_util.h" | 21 #include "ui/gfx/skia_util.h" |
| 21 | 22 |
| 22 using content::BrowserThread; | 23 using content::BrowserThread; |
| 23 using extensions::Extension; | 24 using extensions::Extension; |
| 24 using extensions::IconImage; | 25 using extensions::IconImage; |
| 26 using extensions::Manifest; |
| 25 | 27 |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 SkBitmap CreateBlankBitmapForScale(int size_dip, ui::ScaleFactor scale_factor) { | 30 SkBitmap CreateBlankBitmapForScale(int size_dip, ui::ScaleFactor scale_factor) { |
| 29 SkBitmap bitmap; | 31 SkBitmap bitmap; |
| 30 const float scale = ui::GetScaleFactorScale(scale_factor); | 32 const float scale = ui::GetScaleFactorScale(scale_factor); |
| 31 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 33 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
| 32 static_cast<int>(size_dip * scale), | 34 static_cast<int>(size_dip * scale), |
| 33 static_cast<int>(size_dip * scale)); | 35 static_cast<int>(size_dip * scale)); |
| 34 bitmap.allocPixels(); | 36 bitmap.allocPixels(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 quit_in_image_loaded_ = false; | 134 quit_in_image_loaded_ = false; |
| 133 } | 135 } |
| 134 | 136 |
| 135 int ImageLoadedCount() { | 137 int ImageLoadedCount() { |
| 136 int result = image_loaded_count_; | 138 int result = image_loaded_count_; |
| 137 image_loaded_count_ = 0; | 139 image_loaded_count_ = 0; |
| 138 return result; | 140 return result; |
| 139 } | 141 } |
| 140 | 142 |
| 141 scoped_refptr<Extension> CreateExtension(const char* name, | 143 scoped_refptr<Extension> CreateExtension(const char* name, |
| 142 Extension::Location location) { | 144 Manifest::Location location) { |
| 143 // Create and load an extension. | 145 // Create and load an extension. |
| 144 FilePath test_file; | 146 FilePath test_file; |
| 145 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { | 147 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { |
| 146 EXPECT_FALSE(true); | 148 EXPECT_FALSE(true); |
| 147 return NULL; | 149 return NULL; |
| 148 } | 150 } |
| 149 test_file = test_file.AppendASCII("extensions").AppendASCII(name); | 151 test_file = test_file.AppendASCII("extensions").AppendASCII(name); |
| 150 int error_code = 0; | 152 int error_code = 0; |
| 151 std::string error; | 153 std::string error; |
| 152 JSONFileValueSerializer serializer(test_file.AppendASCII("app.json")); | 154 JSONFileValueSerializer serializer(test_file.AppendASCII("app.json")); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 content::TestBrowserThread file_thread_; | 202 content::TestBrowserThread file_thread_; |
| 201 content::TestBrowserThread io_thread_; | 203 content::TestBrowserThread io_thread_; |
| 202 | 204 |
| 203 DISALLOW_COPY_AND_ASSIGN(ExtensionIconImageTest); | 205 DISALLOW_COPY_AND_ASSIGN(ExtensionIconImageTest); |
| 204 }; | 206 }; |
| 205 | 207 |
| 206 } // namespace | 208 } // namespace |
| 207 | 209 |
| 208 TEST_F(ExtensionIconImageTest, Basic) { | 210 TEST_F(ExtensionIconImageTest, Basic) { |
| 209 scoped_refptr<Extension> extension(CreateExtension( | 211 scoped_refptr<Extension> extension(CreateExtension( |
| 210 "extension_icon_image", Extension::INVALID)); | 212 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 211 ASSERT_TRUE(extension.get() != NULL); | 213 ASSERT_TRUE(extension.get() != NULL); |
| 212 | 214 |
| 213 gfx::ImageSkia default_icon = GetDefaultIcon(); | 215 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 214 | 216 |
| 215 // Load images we expect to find as representations in icon_image, so we | 217 // Load images we expect to find as representations in icon_image, so we |
| 216 // can later use them to validate icon_image. | 218 // can later use them to validate icon_image. |
| 217 SkBitmap bitmap_16 = | 219 SkBitmap bitmap_16 = |
| 218 GetTestBitmap(extension, "16.png", 16); | 220 GetTestBitmap(extension, "16.png", 16); |
| 219 ASSERT_FALSE(bitmap_16.empty()); | 221 ASSERT_FALSE(bitmap_16.empty()); |
| 220 | 222 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // Image should have been resized. | 268 // Image should have been resized. |
| 267 EXPECT_EQ(32, representation.pixel_width()); | 269 EXPECT_EQ(32, representation.pixel_width()); |
| 268 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), | 270 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), |
| 269 bitmap_48_resized_to_32)); | 271 bitmap_48_resized_to_32)); |
| 270 } | 272 } |
| 271 | 273 |
| 272 // There is no resource with either exact or bigger size, but there is a smaller | 274 // There is no resource with either exact or bigger size, but there is a smaller |
| 273 // resource. | 275 // resource. |
| 274 TEST_F(ExtensionIconImageTest, FallbackToSmallerWhenNoBigger) { | 276 TEST_F(ExtensionIconImageTest, FallbackToSmallerWhenNoBigger) { |
| 275 scoped_refptr<Extension> extension(CreateExtension( | 277 scoped_refptr<Extension> extension(CreateExtension( |
| 276 "extension_icon_image", Extension::INVALID)); | 278 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 277 ASSERT_TRUE(extension.get() != NULL); | 279 ASSERT_TRUE(extension.get() != NULL); |
| 278 | 280 |
| 279 gfx::ImageSkia default_icon = GetDefaultIcon(); | 281 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 280 | 282 |
| 281 // Load images we expect to find as representations in icon_image, so we | 283 // Load images we expect to find as representations in icon_image, so we |
| 282 // can later use them to validate icon_image. | 284 // can later use them to validate icon_image. |
| 283 SkBitmap bitmap_48 = | 285 SkBitmap bitmap_48 = |
| 284 GetTestBitmap(extension, "48.png", 48); | 286 GetTestBitmap(extension, "48.png", 48); |
| 285 ASSERT_FALSE(bitmap_48.empty()); | 287 ASSERT_FALSE(bitmap_48.empty()); |
| 286 | 288 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 301 EXPECT_EQ(64, representation.pixel_width()); | 303 EXPECT_EQ(64, representation.pixel_width()); |
| 302 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), | 304 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), |
| 303 EnsureBitmapSize(bitmap_48, 64))); | 305 EnsureBitmapSize(bitmap_48, 64))); |
| 304 } | 306 } |
| 305 | 307 |
| 306 // There is no resource with exact size, but there is a smaller and a bigger | 308 // There is no resource with exact size, but there is a smaller and a bigger |
| 307 // one. Requested size is smaller than 32 though, so the smaller resource should | 309 // one. Requested size is smaller than 32 though, so the smaller resource should |
| 308 // be loaded. | 310 // be loaded. |
| 309 TEST_F(ExtensionIconImageTest, FallbackToSmaller) { | 311 TEST_F(ExtensionIconImageTest, FallbackToSmaller) { |
| 310 scoped_refptr<Extension> extension(CreateExtension( | 312 scoped_refptr<Extension> extension(CreateExtension( |
| 311 "extension_icon_image", Extension::INVALID)); | 313 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 312 ASSERT_TRUE(extension.get() != NULL); | 314 ASSERT_TRUE(extension.get() != NULL); |
| 313 | 315 |
| 314 gfx::ImageSkia default_icon = GetDefaultIcon(); | 316 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 315 | 317 |
| 316 // Load images we expect to find as representations in icon_image, so we | 318 // Load images we expect to find as representations in icon_image, so we |
| 317 // can later use them to validate icon_image. | 319 // can later use them to validate icon_image. |
| 318 SkBitmap bitmap_16 = | 320 SkBitmap bitmap_16 = |
| 319 GetTestBitmap(extension, "16.png", 16); | 321 GetTestBitmap(extension, "16.png", 16); |
| 320 ASSERT_FALSE(bitmap_16.empty()); | 322 ASSERT_FALSE(bitmap_16.empty()); |
| 321 | 323 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 334 EXPECT_EQ(ui::SCALE_FACTOR_100P, representation.scale_factor()); | 336 EXPECT_EQ(ui::SCALE_FACTOR_100P, representation.scale_factor()); |
| 335 EXPECT_EQ(17, representation.pixel_width()); | 337 EXPECT_EQ(17, representation.pixel_width()); |
| 336 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), | 338 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), |
| 337 EnsureBitmapSize(bitmap_16, 17))); | 339 EnsureBitmapSize(bitmap_16, 17))); |
| 338 } | 340 } |
| 339 | 341 |
| 340 // If resource set is empty, |GetRepresentation| should synchronously return | 342 // If resource set is empty, |GetRepresentation| should synchronously return |
| 341 // default icon, without notifying observer of image change. | 343 // default icon, without notifying observer of image change. |
| 342 TEST_F(ExtensionIconImageTest, NoResources) { | 344 TEST_F(ExtensionIconImageTest, NoResources) { |
| 343 scoped_refptr<Extension> extension(CreateExtension( | 345 scoped_refptr<Extension> extension(CreateExtension( |
| 344 "extension_icon_image", Extension::INVALID)); | 346 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 345 ASSERT_TRUE(extension.get() != NULL); | 347 ASSERT_TRUE(extension.get() != NULL); |
| 346 | 348 |
| 347 ExtensionIconSet empty_icon_set; | 349 ExtensionIconSet empty_icon_set; |
| 348 gfx::ImageSkia default_icon = GetDefaultIcon(); | 350 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 349 | 351 |
| 350 const int kRequestedSize = 24; | 352 const int kRequestedSize = 24; |
| 351 IconImage image(extension, empty_icon_set, kRequestedSize, default_icon, | 353 IconImage image(extension, empty_icon_set, kRequestedSize, default_icon, |
| 352 this); | 354 this); |
| 353 | 355 |
| 354 gfx::ImageSkiaRep representation = | 356 gfx::ImageSkiaRep representation = |
| (...skipping 14 matching lines...) Expand all Loading... |
| 369 EnsureBitmapSize( | 371 EnsureBitmapSize( |
| 370 default_icon.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap(), | 372 default_icon.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap(), |
| 371 kRequestedSize))); | 373 kRequestedSize))); |
| 372 } | 374 } |
| 373 | 375 |
| 374 // If resource set is invalid, image load should be done asynchronously and | 376 // If resource set is invalid, image load should be done asynchronously and |
| 375 // the observer should be notified when it's done. |GetRepresentation| should | 377 // the observer should be notified when it's done. |GetRepresentation| should |
| 376 // return the default icon representation once image load is done. | 378 // return the default icon representation once image load is done. |
| 377 TEST_F(ExtensionIconImageTest, InvalidResource) { | 379 TEST_F(ExtensionIconImageTest, InvalidResource) { |
| 378 scoped_refptr<Extension> extension(CreateExtension( | 380 scoped_refptr<Extension> extension(CreateExtension( |
| 379 "extension_icon_image", Extension::INVALID)); | 381 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 380 ASSERT_TRUE(extension.get() != NULL); | 382 ASSERT_TRUE(extension.get() != NULL); |
| 381 | 383 |
| 382 const int kInvalidIconSize = 24; | 384 const int kInvalidIconSize = 24; |
| 383 ExtensionIconSet invalid_icon_set; | 385 ExtensionIconSet invalid_icon_set; |
| 384 invalid_icon_set.Add(kInvalidIconSize, "invalid.png"); | 386 invalid_icon_set.Add(kInvalidIconSize, "invalid.png"); |
| 385 | 387 |
| 386 gfx::ImageSkia default_icon = GetDefaultIcon(); | 388 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 387 | 389 |
| 388 IconImage image(extension, invalid_icon_set, kInvalidIconSize, default_icon, | 390 IconImage image(extension, invalid_icon_set, kInvalidIconSize, default_icon, |
| 389 this); | 391 this); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 404 representation.sk_bitmap(), | 406 representation.sk_bitmap(), |
| 405 EnsureBitmapSize( | 407 EnsureBitmapSize( |
| 406 default_icon.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap(), | 408 default_icon.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap(), |
| 407 kInvalidIconSize))); | 409 kInvalidIconSize))); |
| 408 } | 410 } |
| 409 | 411 |
| 410 // Test that IconImage works with lazily (but synchronously) created default | 412 // Test that IconImage works with lazily (but synchronously) created default |
| 411 // icon when IconImage returns synchronously. | 413 // icon when IconImage returns synchronously. |
| 412 TEST_F(ExtensionIconImageTest, LazyDefaultIcon) { | 414 TEST_F(ExtensionIconImageTest, LazyDefaultIcon) { |
| 413 scoped_refptr<Extension> extension(CreateExtension( | 415 scoped_refptr<Extension> extension(CreateExtension( |
| 414 "extension_icon_image", Extension::INVALID)); | 416 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 415 ASSERT_TRUE(extension.get() != NULL); | 417 ASSERT_TRUE(extension.get() != NULL); |
| 416 | 418 |
| 417 gfx::ImageSkia default_icon = GetDefaultIcon(); | 419 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 418 gfx::ImageSkia lazy_default_icon(new MockImageSkiaSource(default_icon), | 420 gfx::ImageSkia lazy_default_icon(new MockImageSkiaSource(default_icon), |
| 419 default_icon.size()); | 421 default_icon.size()); |
| 420 | 422 |
| 421 ExtensionIconSet empty_icon_set; | 423 ExtensionIconSet empty_icon_set; |
| 422 | 424 |
| 423 const int kRequestedSize = 128; | 425 const int kRequestedSize = 128; |
| 424 IconImage image(extension, empty_icon_set, kRequestedSize, lazy_default_icon, | 426 IconImage image(extension, empty_icon_set, kRequestedSize, lazy_default_icon, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 438 kRequestedSize))); | 440 kRequestedSize))); |
| 439 | 441 |
| 440 // We should have a default icon representation. | 442 // We should have a default icon representation. |
| 441 ASSERT_EQ(1u, image.image_skia().image_reps().size()); | 443 ASSERT_EQ(1u, image.image_skia().image_reps().size()); |
| 442 } | 444 } |
| 443 | 445 |
| 444 // Test that IconImage works with lazily (but synchronously) created default | 446 // Test that IconImage works with lazily (but synchronously) created default |
| 445 // icon when IconImage returns asynchronously. | 447 // icon when IconImage returns asynchronously. |
| 446 TEST_F(ExtensionIconImageTest, LazyDefaultIcon_AsyncIconImage) { | 448 TEST_F(ExtensionIconImageTest, LazyDefaultIcon_AsyncIconImage) { |
| 447 scoped_refptr<Extension> extension(CreateExtension( | 449 scoped_refptr<Extension> extension(CreateExtension( |
| 448 "extension_icon_image", Extension::INVALID)); | 450 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 449 ASSERT_TRUE(extension.get() != NULL); | 451 ASSERT_TRUE(extension.get() != NULL); |
| 450 | 452 |
| 451 gfx::ImageSkia default_icon = GetDefaultIcon(); | 453 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 452 gfx::ImageSkia lazy_default_icon(new MockImageSkiaSource(default_icon), | 454 gfx::ImageSkia lazy_default_icon(new MockImageSkiaSource(default_icon), |
| 453 default_icon.size()); | 455 default_icon.size()); |
| 454 | 456 |
| 455 const int kInvalidIconSize = 24; | 457 const int kInvalidIconSize = 24; |
| 456 ExtensionIconSet invalid_icon_set; | 458 ExtensionIconSet invalid_icon_set; |
| 457 invalid_icon_set.Add(kInvalidIconSize, "invalid.png"); | 459 invalid_icon_set.Add(kInvalidIconSize, "invalid.png"); |
| 458 | 460 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 474 representation = image.image_skia().GetRepresentation(ui::SCALE_FACTOR_100P); | 476 representation = image.image_skia().GetRepresentation(ui::SCALE_FACTOR_100P); |
| 475 EXPECT_TRUE(gfx::BitmapsAreEqual( | 477 EXPECT_TRUE(gfx::BitmapsAreEqual( |
| 476 representation.sk_bitmap(), | 478 representation.sk_bitmap(), |
| 477 EnsureBitmapSize( | 479 EnsureBitmapSize( |
| 478 default_icon.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap(), | 480 default_icon.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap(), |
| 479 kInvalidIconSize))); | 481 kInvalidIconSize))); |
| 480 } | 482 } |
| 481 | 483 |
| 482 TEST_F(ExtensionIconImageTest, LoadPrecachedImage) { | 484 TEST_F(ExtensionIconImageTest, LoadPrecachedImage) { |
| 483 scoped_refptr<Extension> extension(CreateExtension( | 485 scoped_refptr<Extension> extension(CreateExtension( |
| 484 "extension_icon_image", Extension::INVALID)); | 486 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 485 ASSERT_TRUE(extension.get() != NULL); | 487 ASSERT_TRUE(extension.get() != NULL); |
| 486 | 488 |
| 487 gfx::ImageSkia default_icon = GetDefaultIcon(); | 489 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 488 | 490 |
| 489 // Store the image in the cache. | 491 // Store the image in the cache. |
| 490 SkBitmap bitmap_16 = | 492 SkBitmap bitmap_16 = |
| 491 GetTestBitmap(extension, "16.png", 16); | 493 GetTestBitmap(extension, "16.png", 16); |
| 492 ASSERT_FALSE(bitmap_16.empty()); | 494 ASSERT_FALSE(bitmap_16.empty()); |
| 493 extension->SetCachedImage(extension->GetResource("16.png"), bitmap_16, | 495 extension->SetCachedImage(extension->GetResource("16.png"), bitmap_16, |
| 494 gfx::Size(16, 16)); | 496 gfx::Size(16, 16)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 509 EXPECT_EQ(0, ImageLoadedCount()); | 511 EXPECT_EQ(0, ImageLoadedCount()); |
| 510 ASSERT_EQ(1u, image.image_skia().image_reps().size()); | 512 ASSERT_EQ(1u, image.image_skia().image_reps().size()); |
| 511 } | 513 } |
| 512 | 514 |
| 513 // Tests behavior of image created by IconImage after IconImage host goes | 515 // Tests behavior of image created by IconImage after IconImage host goes |
| 514 // away. The image should still return loaded representations. If requested | 516 // away. The image should still return loaded representations. If requested |
| 515 // representation was not loaded while IconImage host was around, transparent | 517 // representation was not loaded while IconImage host was around, transparent |
| 516 // representations should be returned. | 518 // representations should be returned. |
| 517 TEST_F(ExtensionIconImageTest, IconImageDestruction) { | 519 TEST_F(ExtensionIconImageTest, IconImageDestruction) { |
| 518 scoped_refptr<Extension> extension(CreateExtension( | 520 scoped_refptr<Extension> extension(CreateExtension( |
| 519 "extension_icon_image", Extension::INVALID)); | 521 "extension_icon_image", Manifest::INVALID_LOCATION)); |
| 520 ASSERT_TRUE(extension.get() != NULL); | 522 ASSERT_TRUE(extension.get() != NULL); |
| 521 | 523 |
| 522 gfx::ImageSkia default_icon = GetDefaultIcon(); | 524 gfx::ImageSkia default_icon = GetDefaultIcon(); |
| 523 | 525 |
| 524 // Load images we expect to find as representations in icon_image, so we | 526 // Load images we expect to find as representations in icon_image, so we |
| 525 // can later use them to validate icon_image. | 527 // can later use them to validate icon_image. |
| 526 SkBitmap bitmap_16 = | 528 SkBitmap bitmap_16 = |
| 527 GetTestBitmap(extension, "16.png", 16); | 529 GetTestBitmap(extension, "16.png", 16); |
| 528 ASSERT_FALSE(bitmap_16.empty()); | 530 ASSERT_FALSE(bitmap_16.empty()); |
| 529 | 531 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 550 EXPECT_EQ(16, representation.pixel_width()); | 552 EXPECT_EQ(16, representation.pixel_width()); |
| 551 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), bitmap_16)); | 553 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), bitmap_16)); |
| 552 | 554 |
| 553 // When requesting another representation, we should get blank image. | 555 // When requesting another representation, we should get blank image. |
| 554 representation = image_skia.GetRepresentation(ui::SCALE_FACTOR_200P); | 556 representation = image_skia.GetRepresentation(ui::SCALE_FACTOR_200P); |
| 555 | 557 |
| 556 EXPECT_TRUE(gfx::BitmapsAreEqual( | 558 EXPECT_TRUE(gfx::BitmapsAreEqual( |
| 557 representation.sk_bitmap(), | 559 representation.sk_bitmap(), |
| 558 CreateBlankBitmapForScale(16, ui::SCALE_FACTOR_200P))); | 560 CreateBlankBitmapForScale(16, ui::SCALE_FACTOR_200P))); |
| 559 } | 561 } |
| OLD | NEW |