Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / common / extensions / manifest_tests / extension_manifests_web_unittest.cc
blob9fdd7de623cd96e984caae990eef3db6cd09b6dc
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
3 // found in the LICENSE file.
5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "extensions/common/error_utils.h"
10 #include "extensions/common/manifest_constants.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using extensions::ErrorUtils;
14 using extensions::Extension;
16 namespace errors = extensions::manifest_errors;
18 TEST_F(ChromeManifestTest, AppWebUrls) {
19 Testcase testcases[] = {
20 Testcase("web_urls_wrong_type.json", errors::kInvalidWebURLs),
21 Testcase("web_urls_invalid_1.json",
22 ErrorUtils::FormatErrorMessage(
23 errors::kInvalidWebURL,
24 base::IntToString(0),
25 errors::kExpectString)),
26 Testcase("web_urls_invalid_2.json",
27 ErrorUtils::FormatErrorMessage(
28 errors::kInvalidWebURL,
29 base::IntToString(0),
30 URLPattern::GetParseResultString(
31 URLPattern::PARSE_ERROR_MISSING_SCHEME_SEPARATOR))),
32 Testcase("web_urls_invalid_3.json",
33 ErrorUtils::FormatErrorMessage(
34 errors::kInvalidWebURL,
35 base::IntToString(0),
36 errors::kNoWildCardsInPaths)),
37 Testcase("web_urls_invalid_4.json",
38 ErrorUtils::FormatErrorMessage(
39 errors::kInvalidWebURL,
40 base::IntToString(0),
41 errors::kCannotClaimAllURLsInExtent)),
42 Testcase("web_urls_invalid_5.json",
43 ErrorUtils::FormatErrorMessage(
44 errors::kInvalidWebURL,
45 base::IntToString(1),
46 errors::kCannotClaimAllHostsInExtent))
48 RunTestcases(testcases, arraysize(testcases),
49 EXPECT_TYPE_ERROR);
51 LoadAndExpectSuccess("web_urls_has_port.json");
53 scoped_refptr<Extension> extension(
54 LoadAndExpectSuccess("web_urls_default.json"));
55 ASSERT_EQ(1u, extension->web_extent().patterns().size());
56 EXPECT_EQ("*://www.google.com/*",
57 extension->web_extent().patterns().begin()->GetAsString());