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

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

Issue 9536023: Revert 124228 - 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 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebIntents); 778 Testcase testcases[] = {
779 779 {"intent_invalid_1.json", errors::kInvalidIntents},
780 LoadAndExpectError("intent_invalid_1.json", 780 {"intent_invalid_2.json", errors::kInvalidIntent},
781 extension_manifest_errors::kInvalidIntents); 781 {"intent_invalid_3.json", errors::kInvalidIntentPath},
782 LoadAndExpectError("intent_invalid_2.json", 782 {"intent_invalid_4.json", errors::kInvalidIntentDisposition},
783 extension_manifest_errors::kInvalidIntent); 783 {"intent_invalid_5.json", errors::kInvalidIntentType},
784 LoadAndExpectError("intent_invalid_3.json", 784 {"intent_invalid_6.json", errors::kInvalidIntentTitle},
785 extension_manifest_errors::kInvalidIntentPath); 785 {"intent_invalid_packaged_app.json", errors::kCannotAccessPage}
786 LoadAndExpectError("intent_invalid_4.json", 786 };
787 extension_manifest_errors::kInvalidIntentDisposition); 787 RunTestcases(testcases, arraysize(testcases));
788 LoadAndExpectError("intent_invalid_5.json",
789 extension_manifest_errors::kInvalidIntentType);
790 LoadAndExpectError("intent_invalid_6.json",
791 extension_manifest_errors::kInvalidIntentTitle);
792 788
793 scoped_refptr<Extension> extension( 789 scoped_refptr<Extension> extension(
794 LoadAndExpectSuccess("intent_valid.json")); 790 LoadAndExpectSuccess("intent_valid.json"));
795 ASSERT_TRUE(extension.get() != NULL); 791 ASSERT_TRUE(extension.get() != NULL);
796 792
797 ASSERT_EQ(1u, extension->intents_services().size()); 793 ASSERT_EQ(1u, extension->intents_services().size());
798 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents_services()[0].type)); 794 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents_services()[0].type));
799 EXPECT_EQ("http://webintents.org/share", 795 EXPECT_EQ("http://webintents.org/share",
800 UTF16ToUTF8(extension->intents_services()[0].action)); 796 UTF16ToUTF8(extension->intents_services()[0].action));
801 EXPECT_EQ("chrome-extension", 797 EXPECT_EQ("chrome-extension",
(...skipping 13 matching lines...) Expand all
815 EXPECT_EQ("*", UTF16ToUTF8(extension->intents_services()[0].type)); 811 EXPECT_EQ("*", UTF16ToUTF8(extension->intents_services()[0].type));
816 EXPECT_EQ("http://webintents.org/share", 812 EXPECT_EQ("http://webintents.org/share",
817 UTF16ToUTF8(extension->intents_services()[0].action)); 813 UTF16ToUTF8(extension->intents_services()[0].action));
818 EXPECT_TRUE(extension->intents_services()[0].service_url.is_empty()); 814 EXPECT_TRUE(extension->intents_services()[0].service_url.is_empty());
819 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title)); 815 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title));
820 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW, 816 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW,
821 extension->intents_services()[0].disposition); 817 extension->intents_services()[0].disposition);
822 } 818 }
823 819
824 TEST_F(ExtensionManifestTest, WebIntentsWithMultipleMimeTypes) { 820 TEST_F(ExtensionManifestTest, WebIntentsWithMultipleMimeTypes) {
825 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebIntents);
826
827 scoped_refptr<Extension> extension( 821 scoped_refptr<Extension> extension(
828 LoadAndExpectSuccess("intent_valid_multitype.json")); 822 LoadAndExpectSuccess("intent_valid_multitype.json"));
829 ASSERT_TRUE(extension.get() != NULL); 823 ASSERT_TRUE(extension.get() != NULL);
830 824
831 ASSERT_EQ(2u, extension->intents_services().size()); 825 ASSERT_EQ(2u, extension->intents_services().size());
832 826
833 // One registration with multiple types generates a separate service for 827 // One registration with multiple types generates a separate service for
834 // each MIME type. 828 // each MIME type.
835 for (int i = 0; i < 2; ++i) { 829 for (int i = 0; i < 2; ++i) {
836 EXPECT_EQ("http://webintents.org/share", 830 EXPECT_EQ("http://webintents.org/share",
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 EXPECT_EQ("", extension->page_action()->id()); 1078 EXPECT_EQ("", extension->page_action()->id());
1085 EXPECT_EQ(0u, extension->page_action()->icon_paths()->size()); 1079 EXPECT_EQ(0u, extension->page_action()->icon_paths()->size());
1086 EXPECT_EQ("", extension->page_action()->GetTitle( 1080 EXPECT_EQ("", extension->page_action()->GetTitle(
1087 ExtensionAction::kDefaultTabId)); 1081 ExtensionAction::kDefaultTabId));
1088 EXPECT_FALSE(extension->page_action()->HasPopup( 1082 EXPECT_FALSE(extension->page_action()->HasPopup(
1089 ExtensionAction::kDefaultTabId)); 1083 ExtensionAction::kDefaultTabId));
1090 1084
1091 LoadAndExpectError("page_action_manifest_version_2b.json", 1085 LoadAndExpectError("page_action_manifest_version_2b.json",
1092 errors::kInvalidPageActionPopup); 1086 errors::kInvalidPageActionPopup);
1093 } 1087 }
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