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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 TEST_F(ResourceBundleTest, LocaleDataPakExists) { | 327 TEST_F(ResourceBundleTest, LocaleDataPakExists) { |
328 ResourceBundle* resource_bundle = CreateResourceBundle(NULL); | 328 ResourceBundle* resource_bundle = CreateResourceBundle(NULL); |
329 | 329 |
330 // Check that ResourceBundle::LocaleDataPakExists returns the correct results. | 330 // Check that ResourceBundle::LocaleDataPakExists returns the correct results. |
331 EXPECT_TRUE(resource_bundle->LocaleDataPakExists("en-US")); | 331 EXPECT_TRUE(resource_bundle->LocaleDataPakExists("en-US")); |
332 EXPECT_FALSE(resource_bundle->LocaleDataPakExists("not_a_real_locale")); | 332 EXPECT_FALSE(resource_bundle->LocaleDataPakExists("not_a_real_locale")); |
333 } | 333 } |
334 | 334 |
335 class ResourceBundleImageTest : public ResourceBundleTest { | 335 class ResourceBundleImageTest : public ResourceBundleTest { |
336 public: | 336 public: |
337 ResourceBundleImageTest() : locale_pack_(NULL) { | 337 ResourceBundleImageTest() {} |
338 } | |
339 | 338 |
340 virtual ~ResourceBundleImageTest() { | 339 virtual ~ResourceBundleImageTest() { |
341 } | 340 } |
342 | 341 |
343 virtual void SetUp() OVERRIDE { | 342 virtual void SetUp() OVERRIDE { |
344 // Create a temporary directory to write test resource bundles to. | 343 // Create a temporary directory to write test resource bundles to. |
345 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 344 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
346 } | 345 } |
347 | 346 |
348 // Returns resource bundle which uses an empty data pak for locale data. | 347 // Returns resource bundle which uses an empty data pak for locale data. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak(); | 540 ResourceBundle* resource_bundle = CreateResourceBundleWithEmptyLocalePak(); |
542 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); | 541 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); |
543 | 542 |
544 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); | 543 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); |
545 EXPECT_EQ(1u, image_skia->image_reps().size()); | 544 EXPECT_EQ(1u, image_skia->image_reps().size()); |
546 EXPECT_EQ(ui::SCALE_FACTOR_100P, | 545 EXPECT_EQ(ui::SCALE_FACTOR_100P, |
547 image_skia->image_reps()[0].scale_factor()); | 546 image_skia->image_reps()[0].scale_factor()); |
548 } | 547 } |
549 | 548 |
550 } // namespace ui | 549 } // namespace ui |
OLD | NEW |