| 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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 gfx::ImageSkiaRep image_rep = | 555 gfx::ImageSkiaRep image_rep = |
| 556 image_skia->GetRepresentation( | 556 image_skia->GetRepresentation( |
| 557 GetImageScale(ui::SCALE_FACTOR_140P)); | 557 GetImageScale(ui::SCALE_FACTOR_140P)); |
| 558 EXPECT_EQ(12, image_rep.pixel_width()); | 558 EXPECT_EQ(12, image_rep.pixel_width()); |
| 559 image_rep = image_skia->GetRepresentation( | 559 image_rep = image_skia->GetRepresentation( |
| 560 GetImageScale(ui::SCALE_FACTOR_180P)); | 560 GetImageScale(ui::SCALE_FACTOR_180P)); |
| 561 EXPECT_EQ(15, image_rep.pixel_width()); | 561 EXPECT_EQ(15, image_rep.pixel_width()); |
| 562 } | 562 } |
| 563 #endif | 563 #endif |
| 564 | 564 |
| 565 TEST_F(ResourceBundleImageTest, FallbackToNone) { | 565 #if defined(OS_IOS) |
| 566 // Fails on devices that have non-100P scaling. See crbug.com/298406 |
| 567 #define MAYBE_FallbackToNone DISABLED_FallbackToNone |
| 568 #else |
| 569 #define MAYBE_FallbackToNone FallbackToNone |
| 570 #endif |
| 571 TEST_F(ResourceBundleImageTest, MAYBE_FallbackToNone) { |
| 566 base::FilePath data_default_path = dir_path().AppendASCII("sample.pak"); | 572 base::FilePath data_default_path = dir_path().AppendASCII("sample.pak"); |
| 567 | 573 |
| 568 // Create the pak files. | 574 // Create the pak files. |
| 569 CreateDataPackWithSingleBitmap(data_default_path, 10, base::StringPiece()); | 575 CreateDataPackWithSingleBitmap(data_default_path, 10, base::StringPiece()); |
| 570 | 576 |
| 571 // Load the regular pak files only. | 577 // Load the regular pak files only. |
| 572 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak(); | 578 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak(); |
| 573 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); | 579 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); |
| 574 | 580 |
| 575 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); | 581 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); |
| 576 EXPECT_EQ(1u, image_skia->image_reps().size()); | 582 EXPECT_EQ(1u, image_skia->image_reps().size()); |
| 577 EXPECT_EQ(ui::SCALE_FACTOR_100P, | 583 EXPECT_EQ(ui::SCALE_FACTOR_100P, |
| 578 GetSupportedScaleFactor(image_skia->image_reps()[0].scale())); | 584 GetSupportedScaleFactor(image_skia->image_reps()[0].scale())); |
| 579 } | 585 } |
| 580 | 586 |
| 581 } // namespace ui | 587 } // namespace ui |
| OLD | NEW |