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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_web_intents_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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.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/web_intents_handler.h" 9 #include "chrome/common/extensions/web_intents_handler.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "webkit/glue/web_intent_service_data.h" 11 #include "webkit/glue/web_intent_service_data.h"
12 12
13 using extensions::Extension; 13 using extensions::Extension;
14 using extensions::WebIntentsInfo; 14 using extensions::WebIntentsInfo;
15 15
16 namespace errors = extension_manifest_errors; 16 namespace errors = extension_manifest_errors;
17 17
18 class WebIntentsManifestTest : public ExtensionManifestTest { 18 class WebIntentsManifestTest : public ExtensionManifestTest {
19 virtual void SetUp() OVERRIDE { 19 virtual void SetUp() OVERRIDE {
20 ExtensionManifestTest::SetUp(); 20 ExtensionManifestTest::SetUp();
21 extensions::ManifestHandler::Register(extension_manifest_keys::kIntents, 21 extensions::ManifestHandler::Register(
22 new extensions::WebIntentsHandler); 22 extension_manifest_keys::kIntents,
23 make_linked_ptr(new extensions::WebIntentsHandler));
23 } 24 }
24 }; 25 };
25 26
26 TEST_F(WebIntentsManifestTest, WebIntents) { 27 TEST_F(WebIntentsManifestTest, WebIntents) {
27 Testcase testcases[] = { 28 Testcase testcases[] = {
28 Testcase("intent_invalid_1.json", errors::kInvalidIntents), 29 Testcase("intent_invalid_1.json", errors::kInvalidIntents),
29 Testcase("intent_invalid_2.json", errors::kInvalidIntent), 30 Testcase("intent_invalid_2.json", errors::kInvalidIntent),
30 Testcase("intent_invalid_3.json", errors::kInvalidIntentHref), 31 Testcase("intent_invalid_3.json", errors::kInvalidIntentHref),
31 Testcase("intent_invalid_4.json", errors::kInvalidIntentDisposition), 32 Testcase("intent_invalid_4.json", errors::kInvalidIntentDisposition),
32 Testcase("intent_invalid_5.json", errors::kInvalidIntentType), 33 Testcase("intent_invalid_5.json", errors::kInvalidIntentType),
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 170
170 extension = LoadAndExpectSuccess("intent_valid_blank_action_packaged.json"); 171 extension = LoadAndExpectSuccess("intent_valid_blank_action_packaged.json");
171 ASSERT_TRUE(extension); 172 ASSERT_TRUE(extension);
172 173
173 ASSERT_EQ(1u, WebIntentsInfo::GetIntentsServices(extension).size()); 174 ASSERT_EQ(1u, WebIntentsInfo::GetIntentsServices(extension).size());
174 EXPECT_EQ("chrome-extension", 175 EXPECT_EQ("chrome-extension",
175 WebIntentsInfo::GetIntentsServices(extension)[0].service_url.scheme()); 176 WebIntentsInfo::GetIntentsServices(extension)[0].service_url.scheme());
176 EXPECT_EQ("/main.html", 177 EXPECT_EQ("/main.html",
177 WebIntentsInfo::GetIntentsServices(extension)[0].service_url.path()); 178 WebIntentsInfo::GetIntentsServices(extension)[0].service_url.path());
178 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698