Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / common / extensions / manifest_tests / extension_manifests_homepage_unittest.cc
blobc066adcb8cc3c86501c2a574aa46a35ef4349d1a
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 "base/strings/string_util.h"
6 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
7 #include "extensions/common/extension.h"
8 #include "extensions/common/manifest_constants.h"
9 #include "extensions/common/manifest_url_handlers.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace errors = extensions::manifest_errors;
14 class HomepageURLManifestTest : public ChromeManifestTest {
17 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) {
18 scoped_refptr<extensions::Extension> extension(
19 LoadAndExpectSuccess("homepage_valid.json"));
21 Testcase testcases[] = {
22 Testcase("homepage_empty.json",
23 errors::kInvalidHomepageURL),
24 Testcase("homepage_invalid.json",
25 errors::kInvalidHomepageURL),
26 Testcase("homepage_bad_schema.json",
27 errors::kInvalidHomepageURL)
29 RunTestcases(testcases, arraysize(testcases),
30 EXPECT_TYPE_ERROR);
33 TEST_F(HomepageURLManifestTest, GetHomepageURL) {
34 scoped_refptr<extensions::Extension> extension(
35 LoadAndExpectSuccess("homepage_valid.json"));
36 EXPECT_EQ(GURL("http://foo.com#bar"),
37 extensions::ManifestURL::GetHomepageURL(extension.get()));
39 // The Google Gallery URL ends with the id, which depends on the path, which
40 // can be different in testing, so we just check the part before id.
41 extension = LoadAndExpectSuccess("homepage_google_hosted.json");
42 EXPECT_TRUE(base::StartsWith(
43 extensions::ManifestURL::GetHomepageURL(extension.get()).spec(),
44 "https://chrome.google.com/webstore/detail/",
45 base::CompareCase::INSENSITIVE_ASCII));
47 extension = LoadAndExpectSuccess("homepage_externally_hosted.json");
48 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension.get()));