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

Side by Side Diff: chrome/common/extensions/extension_l10n_util_unittest.cc

Issue 5643002: Add utility function to determine if a locale is valid syntax; this will... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 5 #include "app/l10n_util.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/linked_ptr.h" 8 #include "base/linked_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 "sr", 210 "sr",
211 valid_locales, 211 valid_locales,
212 &error)); 212 &error));
213 EXPECT_TRUE(NULL != message_bundle.get()); 213 EXPECT_TRUE(NULL != message_bundle.get());
214 EXPECT_TRUE(error.empty()); 214 EXPECT_TRUE(error.empty());
215 } 215 }
216 216
217 TEST(ExtensionL10nUtil, GetParentLocales) { 217 TEST(ExtensionL10nUtil, GetParentLocales) {
218 std::vector<std::string> locales; 218 std::vector<std::string> locales;
219 const std::string top_locale("sr_Cyrl_RS"); 219 const std::string top_locale("sr_Cyrl_RS");
220 extension_l10n_util::GetParentLocales(top_locale, &locales); 220 l10n_util::GetParentLocales(top_locale, &locales);
221 221
222 ASSERT_EQ(3U, locales.size()); 222 ASSERT_EQ(3U, locales.size());
223 EXPECT_EQ("sr_Cyrl_RS", locales[0]); 223 EXPECT_EQ("sr_Cyrl_RS", locales[0]);
224 EXPECT_EQ("sr_Cyrl", locales[1]); 224 EXPECT_EQ("sr_Cyrl", locales[1]);
225 EXPECT_EQ("sr", locales[2]); 225 EXPECT_EQ("sr", locales[2]);
226 } 226 }
Nebojša Ćirić 2010/12/10 21:48:45 This test should go to app/l10n_util_unittest.cc
227 227
228 // Caller owns the returned object. 228 // Caller owns the returned object.
229 ExtensionMessageBundle* CreateManifestBundle() { 229 ExtensionMessageBundle* CreateManifestBundle() {
230 linked_ptr<DictionaryValue> catalog(new DictionaryValue); 230 linked_ptr<DictionaryValue> catalog(new DictionaryValue);
231 231
232 DictionaryValue* name_tree = new DictionaryValue(); 232 DictionaryValue* name_tree = new DictionaryValue();
233 name_tree->SetString("message", "name"); 233 name_tree->SetString("message", "name");
234 catalog->Set("name", name_tree); 234 catalog->Set("name", name_tree);
235 235
236 DictionaryValue* description_tree = new DictionaryValue(); 236 DictionaryValue* description_tree = new DictionaryValue();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 DictionaryValue manifest; 429 DictionaryValue manifest;
430 manifest.SetString(keys::kDefaultLocale, "en_US"); 430 manifest.SetString(keys::kDefaultLocale, "en_US");
431 manifest.SetString(keys::kCurrentLocale, "sr"); 431 manifest.SetString(keys::kCurrentLocale, "sr");
432 432
433 ExtensionInfo info(&manifest, "", FilePath(), Extension::LOAD); 433 ExtensionInfo info(&manifest, "", FilePath(), Extension::LOAD);
434 434
435 EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info)); 435 EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info));
436 } 436 }
437 437
438 } // namespace 438 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698