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

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: Fixed includes for moved headers 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..7d89eae4b53eb5c1b7f8332dbf615aff9d053729 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -747,6 +747,51 @@ 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));
+ 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(WebIntentServiceData::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));
+ EXPECT_TRUE(extension->intents()[0].service_url.is_empty());
+ EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].title));
+ EXPECT_EQ(WebIntentServiceData::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");
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/test/data/extensions/manifest_tests/intent_invalid_1.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698