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

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

Issue 12091115: Allow manifest handlers to declare keys they depend on that must be parsed before them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dcronin Created 7 years, 10 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 | Annotate | Revision Log
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(
19 new extensions::HomepageURLHandler); 19 extension_manifest_keys::kHomepageURL,
20 extensions::ManifestHandler::Register(extension_manifest_keys::kUpdateURL, 20 make_linked_ptr(new extensions::HomepageURLHandler));
21 new extensions::UpdateURLHandler); 21 extensions::ManifestHandler::Register(
22 extension_manifest_keys::kUpdateURL,
23 make_linked_ptr(new extensions::UpdateURLHandler));
22 } 24 }
23 }; 25 };
24 26
25 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) { 27 TEST_F(HomepageURLManifestTest, ParseHomepageURLs) {
26 scoped_refptr<extensions::Extension> extension( 28 scoped_refptr<extensions::Extension> extension(
27 LoadAndExpectSuccess("homepage_valid.json")); 29 LoadAndExpectSuccess("homepage_valid.json"));
28 30
29 Testcase testcases[] = { 31 Testcase testcases[] = {
30 Testcase("homepage_empty.json", 32 Testcase("homepage_empty.json",
31 errors::kInvalidHomepageURL), 33 errors::kInvalidHomepageURL),
(...skipping 15 matching lines...) Expand all
47 // The Google Gallery URL ends with the id, which depends on the path, which 49 // The Google Gallery URL ends with the id, which depends on the path, which
48 // can be different in testing, so we just check the part before id. 50 // can be different in testing, so we just check the part before id.
49 extension = LoadAndExpectSuccess("homepage_google_hosted.json"); 51 extension = LoadAndExpectSuccess("homepage_google_hosted.json");
50 EXPECT_TRUE(StartsWithASCII( 52 EXPECT_TRUE(StartsWithASCII(
51 extensions::ManifestURL::GetHomepageURL(extension).spec(), 53 extensions::ManifestURL::GetHomepageURL(extension).spec(),
52 "https://chrome.google.com/webstore/detail/", false)); 54 "https://chrome.google.com/webstore/detail/", false));
53 55
54 extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); 56 extension = LoadAndExpectSuccess("homepage_externally_hosted.json");
55 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension)); 57 EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension));
56 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698