| 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_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static_cast<int>(kSamplePakSize)); | 33 static_cast<int>(kSamplePakSize)); |
| 34 | 34 |
| 35 // Create a resource bundle from the file. | 35 // Create a resource bundle from the file. |
| 36 resource_bundle.LoadTestResources(data_path); | 36 resource_bundle.LoadTestResources(data_path); |
| 37 | 37 |
| 38 const int kUnfoundResourceId = 10000; | 38 const int kUnfoundResourceId = 10000; |
| 39 EXPECT_EQ(NULL, resource_bundle.LoadDataResourceBytes(kUnfoundResourceId)); | 39 EXPECT_EQ(NULL, resource_bundle.LoadDataResourceBytes(kUnfoundResourceId)); |
| 40 | 40 |
| 41 // Give a .pak file that doesn't exist so we will fail to load it. | 41 // Give a .pak file that doesn't exist so we will fail to load it. |
| 42 resource_bundle.AddDataPack(FilePath( | 42 resource_bundle.AddDataPack(FilePath( |
| 43 FILE_PATH_LITERAL("non-existant-file.pak"))); | 43 FILE_PATH_LITERAL("non-existant-file.pak")), 1.0); |
| 44 EXPECT_EQ(NULL, resource_bundle.LoadDataResourceBytes(kUnfoundResourceId)); | 44 EXPECT_EQ(NULL, resource_bundle.LoadDataResourceBytes(kUnfoundResourceId)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST(ResourceBundle, LocaleDataPakExists) { | 47 TEST(ResourceBundle, LocaleDataPakExists) { |
| 48 // Check that ResourceBundle::LocaleDataPakExists returns the correct results. | 48 // Check that ResourceBundle::LocaleDataPakExists returns the correct results. |
| 49 EXPECT_TRUE(ResourceBundle::LocaleDataPakExists("en-US")); | 49 EXPECT_TRUE(ResourceBundle::LocaleDataPakExists("en-US")); |
| 50 EXPECT_FALSE(ResourceBundle::LocaleDataPakExists("not_a_real_locale")); | 50 EXPECT_FALSE(ResourceBundle::LocaleDataPakExists("not_a_real_locale")); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace ui | 53 } // namespace ui |
| OLD | NEW |