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

Side by Side Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 9533015: Revert 119423 - Revert 119306 - Turn web intents build flag on. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | content/browser/intents/intent_injector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 LoadAndExpectSuccess("tts_engine_valid.json")); 768 LoadAndExpectSuccess("tts_engine_valid.json"));
769 769
770 ASSERT_EQ(1u, extension->tts_voices().size()); 770 ASSERT_EQ(1u, extension->tts_voices().size());
771 EXPECT_EQ("name", extension->tts_voices()[0].voice_name); 771 EXPECT_EQ("name", extension->tts_voices()[0].voice_name);
772 EXPECT_EQ("en-US", extension->tts_voices()[0].lang); 772 EXPECT_EQ("en-US", extension->tts_voices()[0].lang);
773 EXPECT_EQ("female", extension->tts_voices()[0].gender); 773 EXPECT_EQ("female", extension->tts_voices()[0].gender);
774 EXPECT_EQ(3U, extension->tts_voices()[0].event_types.size()); 774 EXPECT_EQ(3U, extension->tts_voices()[0].event_types.size());
775 } 775 }
776 776
777 TEST_F(ExtensionManifestTest, WebIntents) { 777 TEST_F(ExtensionManifestTest, WebIntents) {
778 Testcase testcases[] = { 778 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebIntents);
779 {"intent_invalid_1.json", errors::kInvalidIntents}, 779
780 {"intent_invalid_2.json", errors::kInvalidIntent}, 780 LoadAndExpectError("intent_invalid_1.json",
781 {"intent_invalid_3.json", errors::kInvalidIntentPath}, 781 extension_manifest_errors::kInvalidIntents);
782 {"intent_invalid_4.json", errors::kInvalidIntentDisposition}, 782 LoadAndExpectError("intent_invalid_2.json",
783 {"intent_invalid_5.json", errors::kInvalidIntentType}, 783 extension_manifest_errors::kInvalidIntent);
784 {"intent_invalid_6.json", errors::kInvalidIntentTitle}, 784 LoadAndExpectError("intent_invalid_3.json",
785 {"intent_invalid_packaged_app.json", errors::kCannotAccessPage} 785 extension_manifest_errors::kInvalidIntentPath);
786 }; 786 LoadAndExpectError("intent_invalid_4.json",
787 RunTestcases(testcases, arraysize(testcases)); 787 extension_manifest_errors::kInvalidIntentDisposition);
788 LoadAndExpectError("intent_invalid_5.json",
789 extension_manifest_errors::kInvalidIntentType);
790 LoadAndExpectError("intent_invalid_6.json",
791 extension_manifest_errors::kInvalidIntentTitle);
788 792
789 scoped_refptr<Extension> extension( 793 scoped_refptr<Extension> extension(
790 LoadAndExpectSuccess("intent_valid.json")); 794 LoadAndExpectSuccess("intent_valid.json"));
791 ASSERT_TRUE(extension.get() != NULL); 795 ASSERT_TRUE(extension.get() != NULL);
792 796
793 ASSERT_EQ(1u, extension->intents_services().size()); 797 ASSERT_EQ(1u, extension->intents_services().size());
794 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents_services()[0].type)); 798 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents_services()[0].type));
795 EXPECT_EQ("http://webintents.org/share", 799 EXPECT_EQ("http://webintents.org/share",
796 UTF16ToUTF8(extension->intents_services()[0].action)); 800 UTF16ToUTF8(extension->intents_services()[0].action));
797 EXPECT_EQ("chrome-extension", 801 EXPECT_EQ("chrome-extension",
(...skipping 13 matching lines...) Expand all
811 EXPECT_EQ("*", UTF16ToUTF8(extension->intents_services()[0].type)); 815 EXPECT_EQ("*", UTF16ToUTF8(extension->intents_services()[0].type));
812 EXPECT_EQ("http://webintents.org/share", 816 EXPECT_EQ("http://webintents.org/share",
813 UTF16ToUTF8(extension->intents_services()[0].action)); 817 UTF16ToUTF8(extension->intents_services()[0].action));
814 EXPECT_TRUE(extension->intents_services()[0].service_url.is_empty()); 818 EXPECT_TRUE(extension->intents_services()[0].service_url.is_empty());
815 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title)); 819 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title));
816 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW, 820 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW,
817 extension->intents_services()[0].disposition); 821 extension->intents_services()[0].disposition);
818 } 822 }
819 823
820 TEST_F(ExtensionManifestTest, WebIntentsWithMultipleMimeTypes) { 824 TEST_F(ExtensionManifestTest, WebIntentsWithMultipleMimeTypes) {
825 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebIntents);
826
821 scoped_refptr<Extension> extension( 827 scoped_refptr<Extension> extension(
822 LoadAndExpectSuccess("intent_valid_multitype.json")); 828 LoadAndExpectSuccess("intent_valid_multitype.json"));
823 ASSERT_TRUE(extension.get() != NULL); 829 ASSERT_TRUE(extension.get() != NULL);
824 830
825 ASSERT_EQ(2u, extension->intents_services().size()); 831 ASSERT_EQ(2u, extension->intents_services().size());
826 832
827 // One registration with multiple types generates a separate service for 833 // One registration with multiple types generates a separate service for
828 // each MIME type. 834 // each MIME type.
829 for (int i = 0; i < 2; ++i) { 835 for (int i = 0; i < 2; ++i) {
830 EXPECT_EQ("http://webintents.org/share", 836 EXPECT_EQ("http://webintents.org/share",
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 EXPECT_EQ("", extension->page_action()->id()); 1084 EXPECT_EQ("", extension->page_action()->id());
1079 EXPECT_EQ(0u, extension->page_action()->icon_paths()->size()); 1085 EXPECT_EQ(0u, extension->page_action()->icon_paths()->size());
1080 EXPECT_EQ("", extension->page_action()->GetTitle( 1086 EXPECT_EQ("", extension->page_action()->GetTitle(
1081 ExtensionAction::kDefaultTabId)); 1087 ExtensionAction::kDefaultTabId));
1082 EXPECT_FALSE(extension->page_action()->HasPopup( 1088 EXPECT_FALSE(extension->page_action()->HasPopup(
1083 ExtensionAction::kDefaultTabId)); 1089 ExtensionAction::kDefaultTabId));
1084 1090
1085 LoadAndExpectError("page_action_manifest_version_2b.json", 1091 LoadAndExpectError("page_action_manifest_version_2b.json",
1086 errors::kInvalidPageActionPopup); 1092 errors::kInvalidPageActionPopup);
1087 } 1093 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | content/browser/intents/intent_injector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698