| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | |
| 6 | |
| 7 #include "chrome/common/extensions/extension.h" | |
| 8 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 #include "ui/base/l10n/l10n_util.h" | |
| 11 | |
| 12 namespace errors = extension_manifest_errors; | |
| 13 | |
| 14 TEST_F(ExtensionManifestTest, ParseHomepageURLs) { | |
| 15 scoped_refptr<extensions::Extension> extension( | |
| 16 LoadAndExpectSuccess("homepage_valid.json")); | |
| 17 | |
| 18 Testcase testcases[] = { | |
| 19 Testcase("homepage_empty.json", | |
| 20 errors::kInvalidHomepageURL), | |
| 21 Testcase("homepage_invalid.json", | |
| 22 errors::kInvalidHomepageURL), | |
| 23 Testcase("homepage_bad_schema.json", | |
| 24 errors::kInvalidHomepageURL) | |
| 25 }; | |
| 26 RunTestcases(testcases, arraysize(testcases), | |
| 27 EXPECT_TYPE_ERROR); | |
| 28 } | |
| 29 | |
| 30 TEST_F(ExtensionManifestTest, GetHomepageURL) { | |
| 31 scoped_refptr<extensions::Extension> extension( | |
| 32 LoadAndExpectSuccess("homepage_valid.json")); | |
| 33 EXPECT_EQ(GURL("http://foo.com#bar"), extension->GetHomepageURL()); | |
| 34 | |
| 35 // The Google Gallery URL ends with the id, which depends on the path, which | |
| 36 // can be different in testing, so we just check the part before id. | |
| 37 extension = LoadAndExpectSuccess("homepage_google_hosted.json"); | |
| 38 EXPECT_TRUE(StartsWithASCII(extension->GetHomepageURL().spec(), | |
| 39 "https://chrome.google.com/webstore/detail/", | |
| 40 false)); | |
| 41 | |
| 42 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); | |
| 43 EXPECT_EQ(GURL(), extension->GetHomepageURL()); | |
| 44 } | |
| OLD | NEW |