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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc

Issue 11726002: Move the parsing of 'update_url' & 'options_page' URLs out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_parse
Patch Set: fixed HomepageURLManifestTest.GetHomepageURL Created 7 years, 11 months 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 unified diff | Download patch
OLDNEW
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_handler.h" 7 #include "chrome/common/extensions/manifest_handler.h"
8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
9 #include "chrome/common/extensions/manifest_url_handler.h" 9 #include "chrome/common/extensions/manifest_url_handler.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 12
13 namespace errors = extension_manifest_errors; 13 namespace errors = extension_manifest_errors;
14 14
15 class HomepageURLManifestTest : public ExtensionManifestTest { 15 class HomepageURLManifestTest : public ExtensionManifestTest {
16 virtual void SetUp() OVERRIDE { 16 virtual void SetUp() OVERRIDE {
17 ExtensionManifestTest::SetUp(); 17 ExtensionManifestTest::SetUp();
18 extensions::ManifestHandler::Register(extension_manifest_keys::kHomepageURL, 18 extensions::ManifestHandler::Register(extension_manifest_keys::kHomepageURL,
19 new extensions::HomepageURLHandler); 19 new extensions::HomepageURLHandler);
20 extensions::ManifestHandler::Register(extension_manifest_keys::kUpdateURL,
21 new extensions::UpdateURLHandler);
20 } 22 }
21 }; 23 };
22 24
23 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) { 25 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) {
24 scoped_refptr<extensions::Extension> extension( 26 scoped_refptr<extensions::Extension> extension(
25 LoadAndExpectSuccess("homepage_valid.json")); 27 LoadAndExpectSuccess("homepage_valid.json"));
26 28
27 Testcase testcases[] = { 29 Testcase testcases[] = {
28 Testcase("homepage_empty.json", 30 Testcase("homepage_empty.json",
29 errors::kInvalidHomepageURL), 31 errors::kInvalidHomepageURL),
(...skipping 15 matching lines...) Expand all
45 // The Google Gallery URL ends with the id, which depends on the path, which 47 // The Google Gallery URL ends with the id, which depends on the path, which
46 // can be different in testing, so we just check the part before id. 48 // can be different in testing, so we just check the part before id.
47 extension = LoadAndExpectSuccess("homepage_google_hosted.json"); 49 extension = LoadAndExpectSuccess("homepage_google_hosted.json");
48 EXPECT_TRUE(StartsWithASCII( 50 EXPECT_TRUE(StartsWithASCII(
49 extensions::ManifestURL::GetHomepageURL(extension).spec(), 51 extensions::ManifestURL::GetHomepageURL(extension).spec(),
50 "https://chrome.google.com/webstore/detail/", false)); 52 "https://chrome.google.com/webstore/detail/", false));
51 53
52 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); 54 extension = LoadAndExpectSuccess("homepage_externally_hosted.json");
53 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension)); 55 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension));
54 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698