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" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void ManifestTest::LoadAndExpectError( | 188 void ManifestTest::LoadAndExpectError( |
189 char const* manifest_name, | 189 char const* manifest_name, |
190 const std::string& expected_error, | 190 const std::string& expected_error, |
191 extensions::Manifest::Location location, | 191 extensions::Manifest::Location location, |
192 int flags) { | 192 int flags) { |
193 return LoadAndExpectError( | 193 return LoadAndExpectError( |
194 ManifestData(manifest_name), expected_error, location, flags); | 194 ManifestData(manifest_name), expected_error, location, flags); |
195 } | 195 } |
196 | 196 |
197 void ManifestTest::AddPattern(extensions::URLPatternSet* extent, | 197 void ManifestTest::AddPattern(extensions::URLPatternSet* extent, |
198 const std::string& pattern) { | 198 const std::string& pattern) { |
199 int schemes = URLPattern::SCHEME_ALL; | 199 int schemes = URLPattern::SCHEME_ALL; |
200 extent->AddPattern(URLPattern(schemes, pattern)); | 200 extent->AddPattern(URLPattern(schemes, pattern)); |
201 } | 201 } |
202 | 202 |
203 ManifestTest::Testcase::Testcase( | 203 ManifestTest::Testcase::Testcase(const std::string& manifest_filename, |
204 std::string manifest_filename, | 204 const std::string& expected_error, |
205 std::string expected_error, | 205 extensions::Manifest::Location location, |
206 extensions::Manifest::Location location, | 206 int flags) |
207 int flags) | |
208 : manifest_filename_(manifest_filename), | 207 : manifest_filename_(manifest_filename), |
209 expected_error_(expected_error), | 208 expected_error_(expected_error), |
210 location_(location), flags_(flags) { | 209 location_(location), |
211 } | 210 flags_(flags) {} |
212 | 211 |
213 ManifestTest::Testcase::Testcase(std::string manifest_filename, | 212 ManifestTest::Testcase::Testcase(const std::string& manifest_filename, |
214 std::string expected_error) | 213 const std::string& expected_error) |
215 : manifest_filename_(manifest_filename), | 214 : manifest_filename_(manifest_filename), |
216 expected_error_(expected_error), | 215 expected_error_(expected_error), |
217 location_(extensions::Manifest::INTERNAL), | 216 location_(extensions::Manifest::INTERNAL), |
218 flags_(Extension::NO_FLAGS) { | 217 flags_(Extension::NO_FLAGS) {} |
219 } | |
220 | 218 |
221 ManifestTest::Testcase::Testcase(std::string manifest_filename) | 219 ManifestTest::Testcase::Testcase(const std::string& manifest_filename) |
222 : manifest_filename_(manifest_filename), | 220 : manifest_filename_(manifest_filename), |
223 location_(extensions::Manifest::INTERNAL), | 221 location_(extensions::Manifest::INTERNAL), |
224 flags_(Extension::NO_FLAGS) {} | 222 flags_(Extension::NO_FLAGS) {} |
225 | 223 |
226 ManifestTest::Testcase::Testcase( | 224 ManifestTest::Testcase::Testcase(const std::string& manifest_filename, |
227 std::string manifest_filename, | 225 extensions::Manifest::Location location, |
228 extensions::Manifest::Location location, | 226 int flags) |
229 int flags) | |
230 : manifest_filename_(manifest_filename), | 227 : manifest_filename_(manifest_filename), |
231 location_(location), | 228 location_(location), |
232 flags_(flags) {} | 229 flags_(flags) {} |
233 | 230 |
234 void ManifestTest::RunTestcases(const Testcase* testcases, | 231 void ManifestTest::RunTestcases(const Testcase* testcases, |
235 size_t num_testcases, | 232 size_t num_testcases, |
236 ExpectType type) { | 233 ExpectType type) { |
237 for (size_t i = 0; i < num_testcases; ++i) | 234 for (size_t i = 0; i < num_testcases; ++i) |
238 RunTestcase(testcases[i], type); | 235 RunTestcase(testcases[i], type); |
239 } | 236 } |
(...skipping 15 matching lines...) Expand all Loading... |
255 break; | 252 break; |
256 case EXPECT_TYPE_SUCCESS: | 253 case EXPECT_TYPE_SUCCESS: |
257 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), | 254 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), |
258 testcase.location_, | 255 testcase.location_, |
259 testcase.flags_); | 256 testcase.flags_); |
260 break; | 257 break; |
261 } | 258 } |
262 } | 259 } |
263 | 260 |
264 } // namespace extensions | 261 } // namespace extensions |
OLD | NEW |