| 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/message_loop.h" | 8 #include "base/message_loop/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" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 image.reset(); | 556 image.reset(); |
| 557 extension = NULL; | 557 extension = NULL; |
| 558 | 558 |
| 559 // Image skia should still be able to get previously loaded representation. | 559 // Image skia should still be able to get previously loaded representation. |
| 560 representation = image_skia.GetRepresentation(1.0f); | 560 representation = image_skia.GetRepresentation(1.0f); |
| 561 | 561 |
| 562 EXPECT_EQ(1.0f, representation.scale()); | 562 EXPECT_EQ(1.0f, representation.scale()); |
| 563 EXPECT_EQ(16, representation.pixel_width()); | 563 EXPECT_EQ(16, representation.pixel_width()); |
| 564 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), bitmap_16)); | 564 EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), bitmap_16)); |
| 565 | 565 |
| 566 // When requesting another representation, we should get blank image. | 566 // When requesting another representation, we should not crash and return some |
| 567 // image of the size. It could be blank or a rescale from the existing 1.0f |
| 568 // icon. |
| 567 representation = image_skia.GetRepresentation(2.0f); | 569 representation = image_skia.GetRepresentation(2.0f); |
| 568 | 570 |
| 569 EXPECT_TRUE(gfx::BitmapsAreEqual( | 571 EXPECT_EQ(16, representation.GetWidth()); |
| 570 representation.sk_bitmap(), | 572 EXPECT_EQ(16, representation.GetHeight()); |
| 571 CreateBlankBitmapForScale(16, ui::SCALE_FACTOR_200P))); | 573 EXPECT_EQ(2.0f, representation.scale()); |
| 572 } | 574 } |
| OLD | NEW |