| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 static_cast<int>(kEmptyPakSize)); | 365 static_cast<int>(kEmptyPakSize)); |
| 366 | 366 |
| 367 ui::ResourceBundle* resource_bundle = CreateResourceBundle(NULL); | 367 ui::ResourceBundle* resource_bundle = CreateResourceBundle(NULL); |
| 368 | 368 |
| 369 // Load the empty locale data pak. | 369 // Load the empty locale data pak. |
| 370 resource_bundle->LoadTestResources(base::FilePath(), locale_path); | 370 resource_bundle->LoadTestResources(base::FilePath(), locale_path); |
| 371 return resource_bundle; | 371 return resource_bundle; |
| 372 } | 372 } |
| 373 | 373 |
| 374 // Returns the path of temporary directory to write test data packs into. | 374 // Returns the path of temporary directory to write test data packs into. |
| 375 const base::FilePath& dir_path() { return dir_.path(); } | 375 const base::FilePath& dir_path() { return dir_.GetPath(); } |
| 376 | 376 |
| 377 // Returns the number of DataPacks managed by |resource_bundle|. | 377 // Returns the number of DataPacks managed by |resource_bundle|. |
| 378 size_t NumDataPacksInResourceBundle(ResourceBundle* resource_bundle) { | 378 size_t NumDataPacksInResourceBundle(ResourceBundle* resource_bundle) { |
| 379 DCHECK(resource_bundle); | 379 DCHECK(resource_bundle); |
| 380 return resource_bundle->data_packs_.size(); | 380 return resource_bundle->data_packs_.size(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 private: | 383 private: |
| 384 std::unique_ptr<DataPack> locale_pack_; | 384 std::unique_ptr<DataPack> locale_pack_; |
| 385 base::ScopedTempDir dir_; | 385 base::ScopedTempDir dir_; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); | 595 resource_bundle->AddDataPackFromPath(data_default_path, SCALE_FACTOR_NONE); |
| 596 | 596 |
| 597 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); | 597 gfx::ImageSkia* image_skia = resource_bundle->GetImageSkiaNamed(3); |
| 598 EXPECT_EQ(1u, image_skia->image_reps().size()); | 598 EXPECT_EQ(1u, image_skia->image_reps().size()); |
| 599 EXPECT_TRUE(image_skia->image_reps()[0].unscaled()); | 599 EXPECT_TRUE(image_skia->image_reps()[0].unscaled()); |
| 600 EXPECT_EQ(ui::SCALE_FACTOR_100P, | 600 EXPECT_EQ(ui::SCALE_FACTOR_100P, |
| 601 GetSupportedScaleFactor(image_skia->image_reps()[0].scale())); | 601 GetSupportedScaleFactor(image_skia->image_reps()[0].scale())); |
| 602 } | 602 } |
| 603 | 603 |
| 604 } // namespace ui | 604 } // namespace ui |
| OLD | NEW |