| 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 #include "base/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
| 6 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 6 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 7 #include "chrome/common/extensions/manifest_url_handler.h" | 7 #include "chrome/common/extensions/manifest_url_handler.h" |
| 8 #include "extensions/common/extension.h" | 8 #include "extensions/common/extension.h" |
| 9 #include "extensions/common/manifest_constants.h" | 9 #include "extensions/common/manifest_constants.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace errors = extensions::manifest_errors; | 12 namespace errors = extensions::manifest_errors; |
| 13 | 13 |
| 14 class HomepageURLManifestTest : public ExtensionManifestTest { | 14 class HomepageURLManifestTest : public ChromeManifestTest { |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) { | 17 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) { |
| 18 scoped_refptr<extensions::Extension> extension( | 18 scoped_refptr<extensions::Extension> extension( |
| 19 LoadAndExpectSuccess("homepage_valid.json")); | 19 LoadAndExpectSuccess("homepage_valid.json")); |
| 20 | 20 |
| 21 Testcase testcases[] = { | 21 Testcase testcases[] = { |
| 22 Testcase("homepage_empty.json", | 22 Testcase("homepage_empty.json", |
| 23 errors::kInvalidHomepageURL), | 23 errors::kInvalidHomepageURL), |
| 24 Testcase("homepage_invalid.json", | 24 Testcase("homepage_invalid.json", |
| (...skipping 15 matching lines...) Expand all Loading... |
| 40 // can be different in testing, so we just check the part before id. | 40 // can be different in testing, so we just check the part before id. |
| 41 extension = LoadAndExpectSuccess("homepage_google_hosted.json"); | 41 extension = LoadAndExpectSuccess("homepage_google_hosted.json"); |
| 42 EXPECT_TRUE(StartsWithASCII( | 42 EXPECT_TRUE(StartsWithASCII( |
| 43 extensions::ManifestURL::GetHomepageURL(extension.get()).spec(), | 43 extensions::ManifestURL::GetHomepageURL(extension.get()).spec(), |
| 44 "https://chrome.google.com/webstore/detail/", | 44 "https://chrome.google.com/webstore/detail/", |
| 45 false)); | 45 false)); |
| 46 | 46 |
| 47 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); | 47 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); |
| 48 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension.get())); | 48 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension.get())); |
| 49 } | 49 } |
| OLD | NEW |