Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: extensions/utility/unpacker_unittest.cc

Issue 1233043003: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/common/user_script.cc ('k') | google_apis/drive/test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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), false)) 174 ASCIIToUTF16(kExpected),
175 base::CompareCase::INSENSITIVE_ASCII))
175 << "Expected prefix: \"" << kExpected << "\", actual error: \"" 176 << "Expected prefix: \"" << kExpected << "\", actual error: \""
176 << unpacker_->error_message() << "\""; 177 << unpacker_->error_message() << "\"";
177 } 178 }
178 179
179 TEST_F(UnpackerTest, ImageDecodingError) { 180 TEST_F(UnpackerTest, ImageDecodingError) {
180 const char kExpected[] = "Could not decode image: "; 181 const char kExpected[] = "Could not decode image: ";
181 SetupUnpacker("bad_image.crx"); 182 SetupUnpacker("bad_image.crx");
182 EXPECT_FALSE(unpacker_->Run()); 183 EXPECT_FALSE(unpacker_->Run());
183 EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), 184 EXPECT_TRUE(base::StartsWith(unpacker_->error_message(),
184 ASCIIToUTF16(kExpected), false)) 185 ASCIIToUTF16(kExpected),
186 base::CompareCase::INSENSITIVE_ASCII))
185 << "Expected prefix: \"" << kExpected << "\", actual error: \"" 187 << "Expected prefix: \"" << kExpected << "\", actual error: \""
186 << unpacker_->error_message() << "\""; 188 << unpacker_->error_message() << "\"";
187 } 189 }
188 190
189 } // namespace extensions 191 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/user_script.cc ('k') | google_apis/drive/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698