OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 scoped_refptr<Extension> extension( | 740 scoped_refptr<Extension> extension( |
741 LoadAndExpectSuccess("tts_engine_valid.json")); | 741 LoadAndExpectSuccess("tts_engine_valid.json")); |
742 | 742 |
743 ASSERT_EQ(1u, extension->tts_voices().size()); | 743 ASSERT_EQ(1u, extension->tts_voices().size()); |
744 EXPECT_EQ("name", extension->tts_voices()[0].voice_name); | 744 EXPECT_EQ("name", extension->tts_voices()[0].voice_name); |
745 EXPECT_EQ("en-US", extension->tts_voices()[0].lang); | 745 EXPECT_EQ("en-US", extension->tts_voices()[0].lang); |
746 EXPECT_EQ("female", extension->tts_voices()[0].gender); | 746 EXPECT_EQ("female", extension->tts_voices()[0].gender); |
747 EXPECT_EQ(3U, extension->tts_voices()[0].event_types.size()); | 747 EXPECT_EQ(3U, extension->tts_voices()[0].event_types.size()); |
748 } | 748 } |
749 | 749 |
| 750 TEST_F(ExtensionManifestTest, WebIntents) { |
| 751 LoadAndExpectError("intent_invalid_1.json", |
| 752 extension_manifest_errors::kInvalidIntents); |
| 753 LoadAndExpectError("intent_invalid_2.json", |
| 754 extension_manifest_errors::kInvalidIntent); |
| 755 LoadAndExpectError("intent_invalid_3.json", |
| 756 extension_manifest_errors::kInvalidIntentAction); |
| 757 LoadAndExpectError("intent_invalid_4.json", |
| 758 extension_manifest_errors::kInvalidIntentDisposition); |
| 759 LoadAndExpectError("intent_invalid_5.json", |
| 760 extension_manifest_errors::kInvalidIntentType); |
| 761 LoadAndExpectError("intent_invalid_6.json", |
| 762 extension_manifest_errors::kInvalidIntentTitle); |
| 763 LoadAndExpectError("intent_invalid_action_missing.json", |
| 764 extension_manifest_errors::kInvalidIntentAction); |
| 765 |
| 766 scoped_refptr<Extension> extension( |
| 767 LoadAndExpectSuccess("intent_valid.json")); |
| 768 ASSERT_TRUE(extension.get() != NULL); |
| 769 |
| 770 ASSERT_EQ(1u, extension->intents().size()); |
| 771 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents()[0].type)); |
| 772 EXPECT_EQ("http://webintents.org/share", extension->intents()[0].service_url.s
pec()); |
| 773 EXPECT_EQ("/services/share", UTF16ToUTF8(extension->intents()[0].action)); |
| 774 EXPECT_EQ("Sample Sharing Intent", |
| 775 UTF16ToUTF8(extension->intents()[0].title)); |
| 776 EXPECT_EQ(WebIntentData::DISPOSITION_INLINE, |
| 777 extension->intents()[0].disposition); |
| 778 |
| 779 // Verify that optional fields are filled with defaults. |
| 780 extension = LoadAndExpectSuccess("intent_valid_minimal.json"); |
| 781 ASSERT_TRUE(extension.get() != NULL); |
| 782 |
| 783 ASSERT_EQ(1u, extension->intents().size()); |
| 784 EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].type)); |
| 785 EXPECT_EQ("http://webintents.org/share", extension->intents()[0].service_url.s
pec()); |
| 786 EXPECT_EQ("/services/edit", |
| 787 UTF16ToUTF8(extension->intents()[0].action)); |
| 788 EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].title)); |
| 789 EXPECT_EQ(WebIntentData::DISPOSITION_WINDOW, |
| 790 extension->intents()[0].disposition); |
| 791 } |
| 792 |
750 TEST_F(ExtensionManifestTest, ForbidPortsInPermissions) { | 793 TEST_F(ExtensionManifestTest, ForbidPortsInPermissions) { |
751 // Loading as a user would shoud not trigger an error. | 794 // Loading as a user would shoud not trigger an error. |
752 LoadAndExpectSuccess("forbid_ports_in_permissions.json"); | 795 LoadAndExpectSuccess("forbid_ports_in_permissions.json"); |
753 | 796 |
754 // Ideally, loading as a developer would give an error. | 797 // Ideally, loading as a developer would give an error. |
755 // To ensure that we do not error out on a valid permission | 798 // To ensure that we do not error out on a valid permission |
756 // in a future version of chrome, validation is to loose | 799 // in a future version of chrome, validation is to loose |
757 // to flag this case. | 800 // to flag this case. |
758 LoadStrictAndExpectSuccess("forbid_ports_in_permissions.json"); | 801 LoadStrictAndExpectSuccess("forbid_ports_in_permissions.json"); |
759 } | 802 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 scoped_refptr<Extension> extension_2( | 882 scoped_refptr<Extension> extension_2( |
840 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); | 883 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); |
841 EXPECT_FALSE(extension_2->offline_enabled()); | 884 EXPECT_FALSE(extension_2->offline_enabled()); |
842 scoped_refptr<Extension> extension_3( | 885 scoped_refptr<Extension> extension_3( |
843 LoadAndExpectSuccess("offline_default_packaged_app.json")); | 886 LoadAndExpectSuccess("offline_default_packaged_app.json")); |
844 EXPECT_FALSE(extension_3->offline_enabled()); | 887 EXPECT_FALSE(extension_3->offline_enabled()); |
845 scoped_refptr<Extension> extension_4( | 888 scoped_refptr<Extension> extension_4( |
846 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); | 889 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); |
847 EXPECT_TRUE(extension_4->offline_enabled()); | 890 EXPECT_TRUE(extension_4->offline_enabled()); |
848 } | 891 } |
OLD | NEW |