Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: ui/base/resource/resource_bundle_unittest.cc

Issue 322523002: Adding OverrideStringResource API to ResourceBundle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/base/resource/resource_bundle.cc ('K') | « ui/base/resource/resource_bundle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle_unittest.cc
diff --git a/ui/base/resource/resource_bundle_unittest.cc b/ui/base/resource/resource_bundle_unittest.cc
index 991dd06b68e59ebe677601bab01deaa28c561702..f5a74f2c045c8b834264fbebe042aee48b993fc5 100644
--- a/ui/base/resource/resource_bundle_unittest.cc
+++ b/ui/base/resource/resource_bundle_unittest.cc
@@ -308,6 +308,35 @@ TEST_F(ResourceBundleTest, DelegateGetLocalizedString) {
EXPECT_EQ(data, result);
}
+TEST_F(ResourceBundleTest, OverrideStringResource) {
+ ResourceBundle* resource_bundle = CreateResourceBundle(NULL);
+
+ base::string16 data = base::ASCIIToUTF16("My test data");
+ int resource_id = 5;
+
grt (UTC plus 2) 2014/06/09 16:54:44 does it make sense to test that GetLocalizedString
jwd 2014/06/10 20:59:25 Done, but doesn't test the successful return of ac
+ resource_bundle->OverrideStringResource(resource_id, data);
+
+ base::string16 result = resource_bundle->GetLocalizedString(resource_id);
+ EXPECT_EQ(data, result);
+}
+
+TEST_F(ResourceBundleTest, DelegateGetLocalizedStringWithOverride) {
+ MockResourceBundleDelegate delegate;
+ ResourceBundle* resource_bundle = CreateResourceBundle(&delegate);
+
+ base::string16 delegate_data = base::ASCIIToUTF16("My delegate data");
+ int resource_id = 5;
+
+ EXPECT_CALL(delegate, GetLocalizedStringMock(resource_id))
+ .Times(1)
+ .WillOnce(Return(delegate_data));
+
+ base::string16 override_data = base::ASCIIToUTF16("My override data");
+
+ base::string16 result = resource_bundle->GetLocalizedString(resource_id);
+ EXPECT_EQ(delegate_data, result);
+}
+
#if defined(USE_OZONE) && !defined(USE_PANGO)
#define MAYBE_DelegateGetFontList DISABLED_DelegateGetFontList
#else
« ui/base/resource/resource_bundle.cc ('K') | « ui/base/resource/resource_bundle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698