| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 return bundle; | 250 return bundle; |
| 251 } | 251 } |
| 252 | 252 |
| 253 TEST(ExtensionL10nUtil, LocalizeEmptyManifest) { | 253 TEST(ExtensionL10nUtil, LocalizeEmptyManifest) { |
| 254 DictionaryValue manifest; | 254 DictionaryValue manifest; |
| 255 std::string error; | 255 std::string error; |
| 256 scoped_ptr<ExtensionMessageBundle> messages(CreateManifestBundle()); | 256 scoped_ptr<ExtensionMessageBundle> messages(CreateManifestBundle()); |
| 257 | 257 |
| 258 EXPECT_FALSE( | 258 EXPECT_FALSE( |
| 259 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); | 259 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); |
| 260 EXPECT_EQ(errors::kInvalidName, error); | 260 EXPECT_EQ(std::string(errors::kInvalidName), error); |
| 261 } | 261 } |
| 262 | 262 |
| 263 TEST(ExtensionL10nUtil, LocalizeManifestWithoutNameMsgAndEmptyDescription) { | 263 TEST(ExtensionL10nUtil, LocalizeManifestWithoutNameMsgAndEmptyDescription) { |
| 264 DictionaryValue manifest; | 264 DictionaryValue manifest; |
| 265 manifest.SetString(keys::kName, "no __MSG"); | 265 manifest.SetString(keys::kName, "no __MSG"); |
| 266 std::string error; | 266 std::string error; |
| 267 scoped_ptr<ExtensionMessageBundle> messages(CreateManifestBundle()); | 267 scoped_ptr<ExtensionMessageBundle> messages(CreateManifestBundle()); |
| 268 | 268 |
| 269 EXPECT_TRUE( | 269 EXPECT_TRUE( |
| 270 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); | 270 extension_l10n_util::LocalizeManifest(*messages, &manifest, &error)); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 DictionaryValue manifest; | 452 DictionaryValue manifest; |
| 453 manifest.SetString(keys::kDefaultLocale, "en_US"); | 453 manifest.SetString(keys::kDefaultLocale, "en_US"); |
| 454 manifest.SetString(keys::kCurrentLocale, "sr"); | 454 manifest.SetString(keys::kCurrentLocale, "sr"); |
| 455 | 455 |
| 456 ExtensionInfo info(&manifest, "", FilePath(), Extension::LOAD); | 456 ExtensionInfo info(&manifest, "", FilePath(), Extension::LOAD); |
| 457 | 457 |
| 458 EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info)); | 458 EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info)); |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace | 461 } // namespace |
| OLD | NEW |