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

Side by Side Diff: chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc

Issue 16464004: Turn disallowed URL patterns such as <all_urls> for externally_connectable into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: type Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "chrome/common/extensions/extension_manifest_constants.h" 7 #include "chrome/common/extensions/extension_manifest_constants.h"
8 #include "chrome/common/extensions/features/feature.h" 8 #include "chrome/common/extensions/features/feature.h"
9 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" 9 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h"
10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 "www.yahoo.com")), 211 "www.yahoo.com")),
212 EXPECT_TYPE_ERROR); 212 EXPECT_TYPE_ERROR);
213 } 213 }
214 214
215 TEST_F(ExternallyConnectableTest, ErrorNoAllURLs) { 215 TEST_F(ExternallyConnectableTest, ErrorNoAllURLs) {
216 RunTestcase( 216 RunTestcase(
217 Testcase( 217 Testcase(
218 "externally_connectable_error_all_urls.json", 218 "externally_connectable_error_all_urls.json",
219 ErrorUtils::FormatErrorMessage(errors::kErrorWildcardHostsNotAllowed, 219 ErrorUtils::FormatErrorMessage(errors::kErrorWildcardHostsNotAllowed,
220 "<all_urls>")), 220 "<all_urls>")),
221 EXPECT_TYPE_ERROR); 221 EXPECT_TYPE_WARNING);
Yoyo Zhou 2013/06/10 23:51:06 Does this test that the wildcard host patterns wer
not at google - send to devlin 2013/06/11 01:55:23 Good point. Done. This required more changes than
222 } 222 }
223 223
224 TEST_F(ExternallyConnectableTest, ErrorWildcardHost) { 224 TEST_F(ExternallyConnectableTest, ErrorWildcardHost) {
225 RunTestcase( 225 RunTestcase(
226 Testcase( 226 Testcase(
227 "externally_connectable_error_wildcard_host.json", 227 "externally_connectable_error_wildcard_host.json",
228 ErrorUtils::FormatErrorMessage(errors::kErrorWildcardHostsNotAllowed, 228 ErrorUtils::FormatErrorMessage(errors::kErrorWildcardHostsNotAllowed,
229 "http://*/*")), 229 "http://*/*")),
230 EXPECT_TYPE_ERROR); 230 EXPECT_TYPE_WARNING);
231 } 231 }
232 232
233 TEST_F(ExternallyConnectableTest, ErrorNoTLD) { 233 TEST_F(ExternallyConnectableTest, ErrorNoTLD) {
234 RunTestcase( 234 RunTestcase(
235 Testcase( 235 Testcase(
236 "externally_connectable_error_tld.json", 236 "externally_connectable_error_tld.json",
237 ErrorUtils::FormatErrorMessage( 237 ErrorUtils::FormatErrorMessage(
238 errors::kErrorTopLevelDomainsNotAllowed, 238 errors::kErrorTopLevelDomainsNotAllowed,
239 "co.uk", 239 "co.uk",
240 "http://*.co.uk/*")), 240 "http://*.co.uk/*")),
241 EXPECT_TYPE_ERROR); 241 EXPECT_TYPE_WARNING);
242 } 242 }
243 243
244 TEST_F(ExternallyConnectableTest, ErrorNoEffectiveTLD) { 244 TEST_F(ExternallyConnectableTest, ErrorNoEffectiveTLD) {
245 RunTestcase( 245 RunTestcase(
246 Testcase( 246 Testcase(
247 "externally_connectable_error_effective_tld.json", 247 "externally_connectable_error_effective_tld.json",
248 ErrorUtils::FormatErrorMessage( 248 ErrorUtils::FormatErrorMessage(
249 errors::kErrorTopLevelDomainsNotAllowed, 249 errors::kErrorTopLevelDomainsNotAllowed,
250 "appspot.com", 250 "appspot.com",
251 "http://*.appspot.com/*")), 251 "http://*.appspot.com/*")),
252 EXPECT_TYPE_ERROR); 252 EXPECT_TYPE_WARNING);
253 } 253 }
254 254
255 TEST_F(ExternallyConnectableTest, ErrorUnknownTLD) { 255 TEST_F(ExternallyConnectableTest, ErrorUnknownTLD) {
256 RunTestcase( 256 RunTestcase(
257 Testcase( 257 Testcase(
258 "externally_connectable_error_unknown_tld.json", 258 "externally_connectable_error_unknown_tld.json",
259 ErrorUtils::FormatErrorMessage( 259 ErrorUtils::FormatErrorMessage(
260 errors::kErrorTopLevelDomainsNotAllowed, 260 errors::kErrorTopLevelDomainsNotAllowed,
261 "notatld", 261 "notatld",
262 "http://*.notatld/*")), 262 "http://*.notatld/*")),
263 EXPECT_TYPE_ERROR); 263 EXPECT_TYPE_WARNING);
264 } 264 }
265 265
266 } // namespace extensions 266 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/manifest_handlers/externally_connectable.cc ('k') | extensions/common/install_warning.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698