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 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ |
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 extensions::Extension::Location location = | 66 extensions::Extension::Location location = |
67 extensions::Extension::INTERNAL, | 67 extensions::Extension::INTERNAL, |
68 int flags = extensions::Extension::NO_FLAGS); | 68 int flags = extensions::Extension::NO_FLAGS); |
69 | 69 |
70 scoped_refptr<extensions::Extension> LoadAndExpectSuccess( | 70 scoped_refptr<extensions::Extension> LoadAndExpectSuccess( |
71 char const* manifest_name, | 71 char const* manifest_name, |
72 extensions::Extension::Location location = | 72 extensions::Extension::Location location = |
73 extensions::Extension::INTERNAL, | 73 extensions::Extension::INTERNAL, |
74 int flags = extensions::Extension::NO_FLAGS); | 74 int flags = extensions::Extension::NO_FLAGS); |
75 | 75 |
| 76 scoped_refptr<extensions::Extension> LoadAndExpectWarning( |
| 77 const Manifest& manifest, |
| 78 const std::string& expected_error, |
| 79 extensions::Extension::Location location = |
| 80 extensions::Extension::INTERNAL, |
| 81 int flags = extensions::Extension::NO_FLAGS); |
| 82 |
| 83 scoped_refptr<extensions::Extension> LoadAndExpectWarning( |
| 84 char const* manifest_name, |
| 85 const std::string& expected_error, |
| 86 extensions::Extension::Location location = |
| 87 extensions::Extension::INTERNAL, |
| 88 int flags = extensions::Extension::NO_FLAGS); |
| 89 |
76 void VerifyExpectedError(extensions::Extension* extension, | 90 void VerifyExpectedError(extensions::Extension* extension, |
77 const std::string& name, | 91 const std::string& name, |
78 const std::string& error, | 92 const std::string& error, |
79 const std::string& expected_error); | 93 const std::string& expected_error); |
80 | 94 |
81 void LoadAndExpectError(char const* manifest_name, | 95 void LoadAndExpectError(char const* manifest_name, |
82 const std::string& expected_error, | 96 const std::string& expected_error, |
83 extensions::Extension::Location location = | 97 extensions::Extension::Location location = |
84 extensions::Extension::INTERNAL, | 98 extensions::Extension::INTERNAL, |
85 int flags = extensions::Extension::NO_FLAGS); | 99 int flags = extensions::Extension::NO_FLAGS); |
86 | 100 |
87 void LoadAndExpectError(const Manifest& manifest, | 101 void LoadAndExpectError(const Manifest& manifest, |
88 const std::string& expected_error, | 102 const std::string& expected_error, |
89 extensions::Extension::Location location = | 103 extensions::Extension::Location location = |
90 extensions::Extension::INTERNAL, | 104 extensions::Extension::INTERNAL, |
91 int flags = extensions::Extension::NO_FLAGS); | 105 int flags = extensions::Extension::NO_FLAGS); |
92 | 106 |
93 void AddPattern(URLPatternSet* extent, const std::string& pattern); | 107 void AddPattern(URLPatternSet* extent, const std::string& pattern); |
94 | 108 |
95 // used to differentiate between calls to LoadAndExpectError and | 109 // used to differentiate between calls to LoadAndExpectError, |
96 // LoadAndExpectSuccess via function RunTestcases | 110 // LoadAndExpectWarning and LoadAndExpectSuccess via function RunTestcases. |
97 enum EXPECT_TYPE { EXPECT_TYPE_ERROR, EXPECT_TYPE_SUCCESS }; | 111 enum EXPECT_TYPE { |
| 112 EXPECT_TYPE_ERROR, |
| 113 EXPECT_TYPE_WARNING, |
| 114 EXPECT_TYPE_SUCCESS |
| 115 }; |
98 | 116 |
99 struct Testcase { | 117 struct Testcase { |
100 std::string manifest_filename_; | 118 std::string manifest_filename_; |
101 std::string expected_error_; // only used for ExpectedError tests | 119 std::string expected_error_; // only used for ExpectedError tests |
102 extensions::Extension::Location location_; | 120 extensions::Extension::Location location_; |
103 int flags_; | 121 int flags_; |
104 | 122 |
105 Testcase(std::string manifest_filename, std::string expected_error, | 123 Testcase(std::string manifest_filename, std::string expected_error, |
106 extensions::Extension::Location location, int flags); | 124 extensions::Extension::Location location, int flags); |
107 | 125 |
108 Testcase(std::string manifest_filename, std::string expected_error); | 126 Testcase(std::string manifest_filename, std::string expected_error); |
109 | 127 |
110 explicit Testcase(std::string manifest_filename); | 128 explicit Testcase(std::string manifest_filename); |
111 | 129 |
112 Testcase(std::string manifest_filename, | 130 Testcase(std::string manifest_filename, |
113 extensions::Extension::Location location, | 131 extensions::Extension::Location location, |
114 int flags); | 132 int flags); |
115 }; | 133 }; |
116 | 134 |
117 void RunTestcases(const Testcase* testcases, size_t num_testcases, | 135 void RunTestcases(const Testcase* testcases, size_t num_testcases, |
118 EXPECT_TYPE type); | 136 EXPECT_TYPE type); |
119 | 137 |
120 bool enable_apps_; | 138 bool enable_apps_; |
121 }; | 139 }; |
122 | 140 |
123 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ | 141 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ |
OLD | NEW |