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

Unified Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 7917006: Extension loading extracts intents from Manifest data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension_manifests_unittest.cc
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 3d7ed442e37b205ffb8d3ed33955a1c77a871fdf..476641674d008d53f7722dad9e85e789f1639962 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -747,6 +747,50 @@ TEST_F(ExtensionManifestTest, TtsEngine) {
EXPECT_EQ(3U, extension->tts_voices()[0].event_types.size());
}
+TEST_F(ExtensionManifestTest, WebIntents) {
+ CommandLine::ForCurrentProcess()->AppendSwitch("--enable-web-intents");
+
+ LoadAndExpectError("intent_invalid_1.json",
+ extension_manifest_errors::kInvalidIntents);
+ LoadAndExpectError("intent_invalid_2.json",
+ extension_manifest_errors::kInvalidIntent);
+ LoadAndExpectError("intent_invalid_3.json",
+ extension_manifest_errors::kInvalidIntentPath);
+ LoadAndExpectError("intent_invalid_4.json",
+ extension_manifest_errors::kInvalidIntentDisposition);
+ LoadAndExpectError("intent_invalid_5.json",
+ extension_manifest_errors::kInvalidIntentType);
+ LoadAndExpectError("intent_invalid_6.json",
+ extension_manifest_errors::kInvalidIntentTitle);
+
+ scoped_refptr<Extension> extension(
+ LoadAndExpectSuccess("intent_valid.json"));
+ ASSERT_TRUE(extension.get() != NULL);
+
+ ASSERT_EQ(1u, extension->intents().size());
+ EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents()[0].type));
+ EXPECT_EQ("http://webintents.org/share",
+ UTF16ToUTF8(extension->intents()[0].action));
James Hawkins 2011/09/19 18:51:40 Line up params. HAE
groby-ooo-7-16 2011/09/19 21:33:59 Done.
+ EXPECT_EQ("chrome-extension", extension->intents()[0].service_url.scheme());
+ EXPECT_EQ("///services/share", extension->intents()[0].service_url.path());
+ EXPECT_EQ("Sample Sharing Intent",
+ UTF16ToUTF8(extension->intents()[0].title));
+ EXPECT_EQ(WebIntentData::DISPOSITION_INLINE,
+ extension->intents()[0].disposition);
+
+ // Verify that optional fields are filled with defaults.
+ extension = LoadAndExpectSuccess("intent_valid_minimal.json");
+ ASSERT_TRUE(extension.get() != NULL);
+
+ ASSERT_EQ(1u, extension->intents().size());
+ EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].type));
+ EXPECT_EQ("http://webintents.org/share", UTF16ToUTF8(extension->intents()[0].action));
James Hawkins 2011/09/19 18:51:40 80 cols.
groby-ooo-7-16 2011/09/19 21:33:59 Done.
+ EXPECT_TRUE(extension->intents()[0].service_url.is_empty());
+ EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].title));
+ EXPECT_EQ(WebIntentData::DISPOSITION_WINDOW,
+ extension->intents()[0].disposition);
+}
+
TEST_F(ExtensionManifestTest, ForbidPortsInPermissions) {
// Loading as a user would shoud not trigger an error.
LoadAndExpectSuccess("forbid_ports_in_permissions.json");

Powered by Google App Engine
This is Rietveld 408576698