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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 EXPECT_FALSE(unpacker_->Run()); | 82 EXPECT_FALSE(unpacker_->Run()); |
83 EXPECT_EQ(ASCIIToUTF16(errors::kInvalidDefaultLocale), | 83 EXPECT_EQ(ASCIIToUTF16(errors::kInvalidDefaultLocale), |
84 unpacker_->error_message()); | 84 unpacker_->error_message()); |
85 } | 85 } |
86 | 86 |
87 TEST_F(UnpackerTest, InvalidMessagesFile) { | 87 TEST_F(UnpackerTest, InvalidMessagesFile) { |
88 SetupUnpacker("invalid_messages_file.crx"); | 88 SetupUnpacker("invalid_messages_file.crx"); |
89 EXPECT_FALSE(unpacker_->Run()); | 89 EXPECT_FALSE(unpacker_->Run()); |
90 EXPECT_TRUE(base::MatchPattern( | 90 EXPECT_TRUE(base::MatchPattern( |
91 unpacker_->error_message(), | 91 unpacker_->error_message(), |
92 ASCIIToUTF16( | 92 ASCIIToUTF16("*_locales?en_US?messages.json: Line: 2, column: 10," |
93 "*_locales?en_US?messages.json: Line: 2, column: 11," | 93 " Syntax error."))) |
94 " Syntax error."))) | |
95 << unpacker_->error_message(); | 94 << unpacker_->error_message(); |
96 } | 95 } |
97 | 96 |
98 TEST_F(UnpackerTest, MissingDefaultData) { | 97 TEST_F(UnpackerTest, MissingDefaultData) { |
99 SetupUnpacker("missing_default_data.crx"); | 98 SetupUnpacker("missing_default_data.crx"); |
100 EXPECT_FALSE(unpacker_->Run()); | 99 EXPECT_FALSE(unpacker_->Run()); |
101 EXPECT_EQ(ASCIIToUTF16(errors::kLocalesNoDefaultMessages), | 100 EXPECT_EQ(ASCIIToUTF16(errors::kLocalesNoDefaultMessages), |
102 unpacker_->error_message()); | 101 unpacker_->error_message()); |
103 } | 102 } |
104 | 103 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 {FILE_PATH_LITERAL("test/manifest.json"), false}, | 253 {FILE_PATH_LITERAL("test/manifest.json"), false}, |
255 {FILE_PATH_LITERAL("manifest.json/test"), false}, | 254 {FILE_PATH_LITERAL("manifest.json/test"), false}, |
256 {FILE_PATH_LITERAL("other.file"), false}, | 255 {FILE_PATH_LITERAL("other.file"), false}, |
257 }; | 256 }; |
258 base::Callback<bool(const base::FilePath&)> filter = | 257 base::Callback<bool(const base::FilePath&)> filter = |
259 base::Bind(&Unpacker::IsManifestFile); | 258 base::Bind(&Unpacker::IsManifestFile); |
260 RunZipFileFilterTest(cases, filter); | 259 RunZipFileFilterTest(cases, filter); |
261 } | 260 } |
262 | 261 |
263 } // namespace extensions | 262 } // namespace extensions |
OLD | NEW |