OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 std::string data = "{ \"name\":"; | 41 std::string data = "{ \"name\":"; |
42 ASSERT_TRUE(file_util::WriteFile(messages_file, data.c_str(), data.length())); | 42 ASSERT_TRUE(file_util::WriteFile(messages_file, data.c_str(), data.length())); |
43 | 43 |
44 base::DictionaryValue manifest; | 44 base::DictionaryValue manifest; |
45 manifest.SetString(keys::kDefaultLocale, "en"); | 45 manifest.SetString(keys::kDefaultLocale, "en"); |
46 std::string error; | 46 std::string error; |
47 EXPECT_FALSE(extension_l10n_util::ValidateExtensionLocales( | 47 EXPECT_FALSE(extension_l10n_util::ValidateExtensionLocales( |
48 temp.path(), &manifest, &error)); | 48 temp.path(), &manifest, &error)); |
49 EXPECT_THAT(error, | 49 EXPECT_THAT(error, |
50 testing::HasSubstr( | 50 testing::HasSubstr( |
51 UTF16ToUTF8(messages_file.LossyDisplayName()))); | 51 base::UTF16ToUTF8(messages_file.LossyDisplayName()))); |
52 } | 52 } |
53 | 53 |
54 TEST(ExtensionL10nUtil, GetValidLocalesEmptyLocaleFolder) { | 54 TEST(ExtensionL10nUtil, GetValidLocalesEmptyLocaleFolder) { |
55 base::ScopedTempDir temp; | 55 base::ScopedTempDir temp; |
56 ASSERT_TRUE(temp.CreateUniqueTempDir()); | 56 ASSERT_TRUE(temp.CreateUniqueTempDir()); |
57 | 57 |
58 base::FilePath src_path = temp.path().Append(kLocaleFolder); | 58 base::FilePath src_path = temp.path().Append(kLocaleFolder); |
59 ASSERT_TRUE(base::CreateDirectory(src_path)); | 59 ASSERT_TRUE(base::CreateDirectory(src_path)); |
60 | 60 |
61 std::string error; | 61 std::string error; |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 std::vector<std::string> fallback_locales; | 659 std::vector<std::string> fallback_locales; |
660 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); | 660 extension_l10n_util::GetAllFallbackLocales("en_US", "all", &fallback_locales); |
661 ASSERT_EQ(3U, fallback_locales.size()); | 661 ASSERT_EQ(3U, fallback_locales.size()); |
662 | 662 |
663 CHECK_EQ("en_US", fallback_locales[0]); | 663 CHECK_EQ("en_US", fallback_locales[0]); |
664 CHECK_EQ("en", fallback_locales[1]); | 664 CHECK_EQ("en", fallback_locales[1]); |
665 CHECK_EQ("all", fallback_locales[2]); | 665 CHECK_EQ("all", fallback_locales[2]); |
666 } | 666 } |
667 | 667 |
668 } // namespace | 668 } // namespace |
OLD | NEW |