OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/extension_l10n_util.h" | 5 #include "extensions/common/extension_l10n_util.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 EXPECT_TRUE(error.empty()); | 422 EXPECT_TRUE(error.empty()); |
423 } | 423 } |
424 | 424 |
425 TEST(ExtensionL10nUtil, LocalizeManifestWithNameDescriptionFileHandlerTitle) { | 425 TEST(ExtensionL10nUtil, LocalizeManifestWithNameDescriptionFileHandlerTitle) { |
426 base::DictionaryValue manifest; | 426 base::DictionaryValue manifest; |
427 manifest.SetString(keys::kName, "__MSG_name__"); | 427 manifest.SetString(keys::kName, "__MSG_name__"); |
428 manifest.SetString(keys::kDescription, "__MSG_description__"); | 428 manifest.SetString(keys::kDescription, "__MSG_description__"); |
429 base::ListValue* handlers = new base::ListValue(); | 429 base::ListValue* handlers = new base::ListValue(); |
430 manifest.Set(keys::kFileBrowserHandlers, handlers); | 430 manifest.Set(keys::kFileBrowserHandlers, handlers); |
431 handlers->Append(base::MakeUnique<base::DictionaryValue>()); | 431 base::DictionaryValue* handler = new base::DictionaryValue(); |
432 base::DictionaryValue* handler = nullptr; | 432 handlers->Append(base::WrapUnique(handler)); |
433 handlers->GetDictionary(0, &handler); | |
434 handler->SetString(keys::kPageActionDefaultTitle, | 433 handler->SetString(keys::kPageActionDefaultTitle, |
435 "__MSG_file_handler_title__"); | 434 "__MSG_file_handler_title__"); |
436 | 435 |
437 std::string error; | 436 std::string error; |
438 std::unique_ptr<MessageBundle> messages(CreateManifestBundle()); | 437 std::unique_ptr<MessageBundle> messages(CreateManifestBundle()); |
439 | 438 |
440 EXPECT_TRUE( | 439 EXPECT_TRUE( |
441 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); | 440 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); |
442 | 441 |
443 std::string result; | 442 std::string result; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); | 635 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); |
637 ASSERT_EQ(3U, fallback_locales.size()); | 636 ASSERT_EQ(3U, fallback_locales.size()); |
638 | 637 |
639 CHECK_EQ("en_US", fallback_locales[0]); | 638 CHECK_EQ("en_US", fallback_locales[0]); |
640 CHECK_EQ("en", fallback_locales[1]); | 639 CHECK_EQ("en", fallback_locales[1]); |
641 CHECK_EQ("all", fallback_locales[2]); | 640 CHECK_EQ("all", fallback_locales[2]); |
642 } | 641 } |
643 | 642 |
644 } // namespace | 643 } // namespace |
645 } // namespace extensions | 644 } // namespace extensions |
OLD | NEW |