Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2812)

Unified Diff: chrome/common/extensions/api/url_parser/homepage_url_manifests_unittest.cc

Issue 11624036: Move the parsing of homepage_url" and "devtools_page" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/url_parser/homepage_url_manifests_unittest.cc
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc b/chrome/common/extensions/api/url_parser/homepage_url_manifests_unittest.cc
similarity index 56%
rename from chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc
rename to chrome/common/extensions/api/url_parser/homepage_url_manifests_unittest.cc
index 59836afebfa2ca74f3ba227d12df7dda6f03190f..bb5d958849d53dead94e0d09e4544361a509ffce 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc
+++ b/chrome/common/extensions/api/url_parser/homepage_url_manifests_unittest.cc
@@ -2,16 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
-
+#include "chrome/common/extensions/api/url_parser/homepage_url_handler.h"
+#include "chrome/common/extensions/api/url_parser/url_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest_handler.h"
+#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
+namespace keys = extension_manifest_keys;
namespace errors = extension_manifest_errors;
-TEST_F(ExtensionManifestTest, ParseHomepageURLs) {
+namespace {
+
+class HomepageURLManifestTest : public ExtensionManifestTest {
+ virtual void SetUp() OVERRIDE {
+ ExtensionManifestTest::SetUp();
+ extensions::ManifestHandler::Register(keys::kHomepageURL,
+ new extensions::HomepageURLHandler);
+ }
+};
+
+TEST_F(HomepageURLManifestTest, ParseHomepageURLs) {
scoped_refptr<extensions::Extension> extension(
LoadAndExpectSuccess("homepage_valid.json"));
@@ -27,18 +40,22 @@ TEST_F(ExtensionManifestTest, ParseHomepageURLs) {
EXPECT_TYPE_ERROR);
}
-TEST_F(ExtensionManifestTest, GetHomepageURL) {
+TEST_F(HomepageURLManifestTest, GetHomepageURL) {
scoped_refptr<extensions::Extension> extension(
LoadAndExpectSuccess("homepage_valid.json"));
- EXPECT_EQ(GURL("http://foo.com#bar"), extension->GetHomepageURL());
+ EXPECT_EQ(GURL("http://foo.com#bar"), extensions::URLInfo::url(
+ extension, extensions::URLInfo::HOMEPAGE_URL));
// The Google Gallery URL ends with the id, which depends on the path, which
// can be different in testing, so we just check the part before id.
extension = LoadAndExpectSuccess("homepage_google_hosted.json");
- EXPECT_TRUE(StartsWithASCII(extension->GetHomepageURL().spec(),
- "https://chrome.google.com/webstore/detail/",
- false));
+ EXPECT_TRUE(StartsWithASCII(extensions::URLInfo::url(
+ extension, extensions::URLInfo::HOMEPAGE_URL).spec(),
+ "https://chrome.google.com/webstore/detail/", false));
extension = LoadAndExpectSuccess("homepage_externally_hosted.json");
- EXPECT_EQ(GURL(), extension->GetHomepageURL());
+ EXPECT_EQ(GURL(), extensions::URLInfo::url(
+ extension, extensions::URLInfo::HOMEPAGE_URL));
}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698