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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 base::DictionaryValue* handler = new base::DictionaryValue(); | 431 base::DictionaryValue* handler = new base::DictionaryValue(); |
432 handlers->Append(base::WrapUnique(handler)); | 432 handlers->Append(base::WrapUnique(handler)); |
433 // |handler| is invalidated at this point, so it needs to be reset. | |
434 handlers->GetDictionary(handlers->GetSize() - 1, &handler); | |
Devlin
2017/03/15 15:25:04
We can just inline the creation of the new Diction
jdoerrie
2017/03/24 08:54:37
Done.
| |
433 handler->SetString(keys::kPageActionDefaultTitle, | 435 handler->SetString(keys::kPageActionDefaultTitle, |
434 "__MSG_file_handler_title__"); | 436 "__MSG_file_handler_title__"); |
435 | 437 |
436 std::string error; | 438 std::string error; |
437 std::unique_ptr<MessageBundle> messages(CreateManifestBundle()); | 439 std::unique_ptr<MessageBundle> messages(CreateManifestBundle()); |
438 | 440 |
439 EXPECT_TRUE( | 441 EXPECT_TRUE( |
440 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); | 442 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); |
441 | 443 |
442 std::string result; | 444 std::string result; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); | 637 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); |
636 ASSERT_EQ(3U, fallback_locales.size()); | 638 ASSERT_EQ(3U, fallback_locales.size()); |
637 | 639 |
638 CHECK_EQ("en_US", fallback_locales[0]); | 640 CHECK_EQ("en_US", fallback_locales[0]); |
639 CHECK_EQ("en", fallback_locales[1]); | 641 CHECK_EQ("en", fallback_locales[1]); |
640 CHECK_EQ("all", fallback_locales[2]); | 642 CHECK_EQ("all", fallback_locales[2]); |
641 } | 643 } |
642 | 644 |
643 } // namespace | 645 } // namespace |
644 } // namespace extensions | 646 } // namespace extensions |
OLD | NEW |