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/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/pattern.h" | 8 #include "base/strings/pattern.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } // namespace | 164 } // namespace |
165 | 165 |
166 TEST_F(UnpackerTest, BadPathError) { | 166 TEST_F(UnpackerTest, BadPathError) { |
167 const char kExpected[] = "Illegal path (absolute or relative with '..'): "; | 167 const char kExpected[] = "Illegal path (absolute or relative with '..'): "; |
168 SetupUnpacker("good_package.crx"); | 168 SetupUnpacker("good_package.crx"); |
169 IllegalImagePathInserter inserter( | 169 IllegalImagePathInserter inserter( |
170 static_cast<TestExtensionsClient*>(ExtensionsClient::Get())); | 170 static_cast<TestExtensionsClient*>(ExtensionsClient::Get())); |
171 | 171 |
172 EXPECT_FALSE(unpacker_->Run()); | 172 EXPECT_FALSE(unpacker_->Run()); |
173 EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), | 173 EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), |
174 ASCIIToUTF16(kExpected), | 174 ASCIIToUTF16(kExpected), false)) |
175 base::CompareCase::INSENSITIVE_ASCII)) | |
176 << "Expected prefix: \"" << kExpected << "\", actual error: \"" | 175 << "Expected prefix: \"" << kExpected << "\", actual error: \"" |
177 << unpacker_->error_message() << "\""; | 176 << unpacker_->error_message() << "\""; |
178 } | 177 } |
179 | 178 |
180 TEST_F(UnpackerTest, ImageDecodingError) { | 179 TEST_F(UnpackerTest, ImageDecodingError) { |
181 const char kExpected[] = "Could not decode image: "; | 180 const char kExpected[] = "Could not decode image: "; |
182 SetupUnpacker("bad_image.crx"); | 181 SetupUnpacker("bad_image.crx"); |
183 EXPECT_FALSE(unpacker_->Run()); | 182 EXPECT_FALSE(unpacker_->Run()); |
184 EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), | 183 EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), |
185 ASCIIToUTF16(kExpected), | 184 ASCIIToUTF16(kExpected), false)) |
186 base::CompareCase::INSENSITIVE_ASCII)) | |
187 << "Expected prefix: \"" << kExpected << "\", actual error: \"" | 185 << "Expected prefix: \"" << kExpected << "\", actual error: \"" |
188 << unpacker_->error_message() << "\""; | 186 << unpacker_->error_message() << "\""; |
189 } | 187 } |
190 | 188 |
191 } // namespace extensions | 189 } // namespace extensions |
OLD | NEW |