| 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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 #include "chrome/common/extensions/extension_manifest_constants.h" | 6 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 7 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 7 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 8 #include "chrome/common/extensions/manifest_url_handler.h" | 8 #include "chrome/common/extensions/manifest_url_handler.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 errors::kInvalidHomepageURL) | 27 errors::kInvalidHomepageURL) |
| 28 }; | 28 }; |
| 29 RunTestcases(testcases, arraysize(testcases), | 29 RunTestcases(testcases, arraysize(testcases), |
| 30 EXPECT_TYPE_ERROR); | 30 EXPECT_TYPE_ERROR); |
| 31 } | 31 } |
| 32 | 32 |
| 33 TEST_F(HomepageURLManifestTest, GetHomepageURL) { | 33 TEST_F(HomepageURLManifestTest, GetHomepageURL) { |
| 34 scoped_refptr<extensions::Extension> extension( | 34 scoped_refptr<extensions::Extension> extension( |
| 35 LoadAndExpectSuccess("homepage_valid.json")); | 35 LoadAndExpectSuccess("homepage_valid.json")); |
| 36 EXPECT_EQ(GURL("http://foo.com#bar"), | 36 EXPECT_EQ(GURL("http://foo.com#bar"), |
| 37 extensions::ManifestURL::GetHomepageURL(extension)); | 37 extensions::ManifestURL::GetHomepageURL(extension.get())); |
| 38 | 38 |
| 39 // The Google Gallery URL ends with the id, which depends on the path, which | 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. | 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).spec(), | 43 extensions::ManifestURL::GetHomepageURL(extension.get()).spec(), |
| 44 "https://chrome.google.com/webstore/detail/", false)); | 44 "https://chrome.google.com/webstore/detail/", |
| 45 false)); |
| 45 | 46 |
| 46 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); | 47 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); |
| 47 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension)); | 48 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension.get())); |
| 48 } | 49 } |
| OLD | NEW |