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" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "extensions/common/constants.h" | 17 #include "extensions/common/constants.h" |
17 #include "extensions/common/error_utils.h" | 18 #include "extensions/common/error_utils.h" |
18 #include "extensions/common/extension_paths.h" | 19 #include "extensions/common/extension_paths.h" |
19 #include "extensions/common/manifest_constants.h" | 20 #include "extensions/common/manifest_constants.h" |
20 #include "extensions/common/message_bundle.h" | 21 #include "extensions/common/message_bundle.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 EXPECT_TRUE(error.empty()); | 423 EXPECT_TRUE(error.empty()); |
423 } | 424 } |
424 | 425 |
425 TEST(ExtensionL10nUtil, LocalizeManifestWithNameDescriptionFileHandlerTitle) { | 426 TEST(ExtensionL10nUtil, LocalizeManifestWithNameDescriptionFileHandlerTitle) { |
426 base::DictionaryValue manifest; | 427 base::DictionaryValue manifest; |
427 manifest.SetString(keys::kName, "__MSG_name__"); | 428 manifest.SetString(keys::kName, "__MSG_name__"); |
428 manifest.SetString(keys::kDescription, "__MSG_description__"); | 429 manifest.SetString(keys::kDescription, "__MSG_description__"); |
429 base::ListValue* handlers = new base::ListValue(); | 430 base::ListValue* handlers = new base::ListValue(); |
430 manifest.Set(keys::kFileBrowserHandlers, handlers); | 431 manifest.Set(keys::kFileBrowserHandlers, handlers); |
431 base::DictionaryValue* handler = new base::DictionaryValue(); | 432 base::DictionaryValue* handler = new base::DictionaryValue(); |
432 handlers->Append(handler); | 433 handlers->Append(base::WrapUnique(handler)); |
433 handler->SetString(keys::kPageActionDefaultTitle, | 434 handler->SetString(keys::kPageActionDefaultTitle, |
434 "__MSG_file_handler_title__"); | 435 "__MSG_file_handler_title__"); |
435 | 436 |
436 std::string error; | 437 std::string error; |
437 std::unique_ptr<MessageBundle> messages(CreateManifestBundle()); | 438 std::unique_ptr<MessageBundle> messages(CreateManifestBundle()); |
438 | 439 |
439 EXPECT_TRUE( | 440 EXPECT_TRUE( |
440 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); | 441 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); |
441 | 442 |
442 std::string result; | 443 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); | 636 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); |
636 ASSERT_EQ(3U, fallback_locales.size()); | 637 ASSERT_EQ(3U, fallback_locales.size()); |
637 | 638 |
638 CHECK_EQ("en_US", fallback_locales[0]); | 639 CHECK_EQ("en_US", fallback_locales[0]); |
639 CHECK_EQ("en", fallback_locales[1]); | 640 CHECK_EQ("en", fallback_locales[1]); |
640 CHECK_EQ("all", fallback_locales[2]); | 641 CHECK_EQ("all", fallback_locales[2]); |
641 } | 642 } |
642 | 643 |
643 } // namespace | 644 } // namespace |
644 } // namespace extensions | 645 } // namespace extensions |
OLD | NEW |