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 "extensions/common/manifest_test.h" | 5 #include "extensions/common/manifest_test.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/strings/pattern.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "extensions/common/extension_l10n_util.h" | 14 #include "extensions/common/extension_l10n_util.h" |
14 #include "extensions/common/extension_paths.h" | 15 #include "extensions/common/extension_paths.h" |
15 #include "extensions/common/test_util.h" | 16 #include "extensions/common/test_util.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 namespace { | 20 namespace { |
20 | 21 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 161 } |
161 | 162 |
162 void ManifestTest::VerifyExpectedError( | 163 void ManifestTest::VerifyExpectedError( |
163 Extension* extension, | 164 Extension* extension, |
164 const std::string& name, | 165 const std::string& name, |
165 const std::string& error, | 166 const std::string& error, |
166 const std::string& expected_error) { | 167 const std::string& expected_error) { |
167 EXPECT_FALSE(extension) << | 168 EXPECT_FALSE(extension) << |
168 "Expected failure loading extension '" << name << | 169 "Expected failure loading extension '" << name << |
169 "', but didn't get one."; | 170 "', but didn't get one."; |
170 EXPECT_TRUE(MatchPattern(error, expected_error)) << name << | 171 EXPECT_TRUE(base::MatchPattern(error, expected_error)) |
171 " expected '" << expected_error << "' but got '" << error << "'"; | 172 << name << " expected '" << expected_error << "' but got '" << error |
| 173 << "'"; |
172 } | 174 } |
173 | 175 |
174 void ManifestTest::LoadAndExpectError( | 176 void ManifestTest::LoadAndExpectError( |
175 const ManifestData& manifest, | 177 const ManifestData& manifest, |
176 const std::string& expected_error, | 178 const std::string& expected_error, |
177 extensions::Manifest::Location location, | 179 extensions::Manifest::Location location, |
178 int flags) { | 180 int flags) { |
179 std::string error; | 181 std::string error; |
180 scoped_refptr<Extension> extension( | 182 scoped_refptr<Extension> extension( |
181 LoadExtension(manifest, &error, location, flags)); | 183 LoadExtension(manifest, &error, location, flags)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 break; | 255 break; |
254 case EXPECT_TYPE_SUCCESS: | 256 case EXPECT_TYPE_SUCCESS: |
255 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), | 257 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), |
256 testcase.location_, | 258 testcase.location_, |
257 testcase.flags_); | 259 testcase.flags_); |
258 break; | 260 break; |
259 } | 261 } |
260 } | 262 } |
261 | 263 |
262 } // namespace extensions | 264 } // namespace extensions |
OLD | NEW |