| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/extensions/extension_constants.h" | 10 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 SetupUnpacker("missing_messages_file.crx"); | 93 SetupUnpacker("missing_messages_file.crx"); |
| 94 EXPECT_FALSE(unpacker_->Run()); | 94 EXPECT_FALSE(unpacker_->Run()); |
| 95 EXPECT_TRUE(MatchPatternASCII(unpacker_->error_message(), | 95 EXPECT_TRUE(MatchPatternASCII(unpacker_->error_message(), |
| 96 errors::kLocalesMessagesFileMissing + | 96 errors::kLocalesMessagesFileMissing + |
| 97 std::string("*_locales?en_US?messages.json"))); | 97 std::string("*_locales?en_US?messages.json"))); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST_F(ExtensionUnpackerTest, NoLocaleData) { | 100 TEST_F(ExtensionUnpackerTest, NoLocaleData) { |
| 101 SetupUnpacker("no_locale_data.crx"); | 101 SetupUnpacker("no_locale_data.crx"); |
| 102 EXPECT_FALSE(unpacker_->Run()); | 102 EXPECT_FALSE(unpacker_->Run()); |
| 103 EXPECT_EQ(errors::kLocalesTreeMissing, unpacker_->error_message()); | 103 EXPECT_EQ(errors::kLocalesNoDefaultMessages, unpacker_->error_message()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 TEST_F(ExtensionUnpackerTest, GoodL10n) { | 106 TEST_F(ExtensionUnpackerTest, GoodL10n) { |
| 107 SetupUnpacker("good_l10n.crx"); | 107 SetupUnpacker("good_l10n.crx"); |
| 108 EXPECT_TRUE(unpacker_->Run()); | 108 EXPECT_TRUE(unpacker_->Run()); |
| 109 EXPECT_TRUE(unpacker_->error_message().empty()); | 109 EXPECT_TRUE(unpacker_->error_message().empty()); |
| 110 ASSERT_EQ(2U, unpacker_->parsed_catalogs()->size()); | 110 ASSERT_EQ(2U, unpacker_->parsed_catalogs()->size()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 TEST_F(ExtensionUnpackerTest, NoL10n) { | 113 TEST_F(ExtensionUnpackerTest, NoL10n) { |
| 114 SetupUnpacker("no_l10n.crx"); | 114 SetupUnpacker("no_l10n.crx"); |
| 115 EXPECT_TRUE(unpacker_->Run()); | 115 EXPECT_TRUE(unpacker_->Run()); |
| 116 EXPECT_TRUE(unpacker_->error_message().empty()); | 116 EXPECT_TRUE(unpacker_->error_message().empty()); |
| 117 EXPECT_EQ(0U, unpacker_->parsed_catalogs()->size()); | 117 EXPECT_EQ(0U, unpacker_->parsed_catalogs()->size()); |
| 118 } | 118 } |
| OLD | NEW |