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

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

Issue 8417043: Add webkit_glue namespace. Improve some variable and test names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error Created 9 years, 1 month 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') | webkit/glue/web_intent_service_data.h » ('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) 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 extension_manifest_errors::kInvalidIntentDisposition); 828 extension_manifest_errors::kInvalidIntentDisposition);
829 LoadAndExpectError("intent_invalid_5.json", 829 LoadAndExpectError("intent_invalid_5.json",
830 extension_manifest_errors::kInvalidIntentType); 830 extension_manifest_errors::kInvalidIntentType);
831 LoadAndExpectError("intent_invalid_6.json", 831 LoadAndExpectError("intent_invalid_6.json",
832 extension_manifest_errors::kInvalidIntentTitle); 832 extension_manifest_errors::kInvalidIntentTitle);
833 833
834 scoped_refptr<Extension> extension( 834 scoped_refptr<Extension> extension(
835 LoadAndExpectSuccess("intent_valid.json")); 835 LoadAndExpectSuccess("intent_valid.json"));
836 ASSERT_TRUE(extension.get() != NULL); 836 ASSERT_TRUE(extension.get() != NULL);
837 837
838 ASSERT_EQ(1u, extension->intents().size()); 838 ASSERT_EQ(1u, extension->intents_services().size());
839 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents()[0].type)); 839 EXPECT_EQ("image/png", UTF16ToUTF8(extension->intents_services()[0].type));
840 EXPECT_EQ("http://webintents.org/share", 840 EXPECT_EQ("http://webintents.org/share",
841 UTF16ToUTF8(extension->intents()[0].action)); 841 UTF16ToUTF8(extension->intents_services()[0].action));
842 EXPECT_EQ("chrome-extension", extension->intents()[0].service_url.scheme()); 842 EXPECT_EQ("chrome-extension",
843 EXPECT_EQ("///services/share", extension->intents()[0].service_url.path()); 843 extension->intents_services()[0].service_url.scheme());
844 EXPECT_EQ("///services/share",
845 extension->intents_services()[0].service_url.path());
844 EXPECT_EQ("Sample Sharing Intent", 846 EXPECT_EQ("Sample Sharing Intent",
845 UTF16ToUTF8(extension->intents()[0].title)); 847 UTF16ToUTF8(extension->intents_services()[0].title));
846 EXPECT_EQ(WebIntentServiceData::DISPOSITION_INLINE, 848 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_INLINE,
847 extension->intents()[0].disposition); 849 extension->intents_services()[0].disposition);
848 850
849 // Verify that optional fields are filled with defaults. 851 // Verify that optional fields are filled with defaults.
850 extension = LoadAndExpectSuccess("intent_valid_minimal.json"); 852 extension = LoadAndExpectSuccess("intent_valid_minimal.json");
851 ASSERT_TRUE(extension.get() != NULL); 853 ASSERT_TRUE(extension.get() != NULL);
852 854
853 ASSERT_EQ(1u, extension->intents().size()); 855 ASSERT_EQ(1u, extension->intents_services().size());
854 EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].type)); 856 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].type));
855 EXPECT_EQ("http://webintents.org/share", 857 EXPECT_EQ("http://webintents.org/share",
856 UTF16ToUTF8(extension->intents()[0].action)); 858 UTF16ToUTF8(extension->intents_services()[0].action));
857 EXPECT_TRUE(extension->intents()[0].service_url.is_empty()); 859 EXPECT_TRUE(extension->intents_services()[0].service_url.is_empty());
858 EXPECT_EQ("", UTF16ToUTF8(extension->intents()[0].title)); 860 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title));
859 EXPECT_EQ(WebIntentServiceData::DISPOSITION_WINDOW, 861 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW,
860 extension->intents()[0].disposition); 862 extension->intents_services()[0].disposition);
861 } 863 }
862 864
863 TEST_F(ExtensionManifestTest, ForbidPortsInPermissions) { 865 TEST_F(ExtensionManifestTest, ForbidPortsInPermissions) {
864 // Loading as a user would shoud not trigger an error. 866 // Loading as a user would shoud not trigger an error.
865 LoadAndExpectSuccess("forbid_ports_in_permissions.json"); 867 LoadAndExpectSuccess("forbid_ports_in_permissions.json");
866 868
867 // Ideally, loading as a developer would give an error. 869 // Ideally, loading as a developer would give an error.
868 // To ensure that we do not error out on a valid permission 870 // To ensure that we do not error out on a valid permission
869 // in a future version of chrome, validation is to loose 871 // in a future version of chrome, validation is to loose
870 // to flag this case. 872 // to flag this case.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 scoped_refptr<Extension> extension_2( 955 scoped_refptr<Extension> extension_2(
954 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); 956 LoadAndExpectSuccess("offline_disabled_packaged_app.json"));
955 EXPECT_FALSE(extension_2->offline_enabled()); 957 EXPECT_FALSE(extension_2->offline_enabled());
956 scoped_refptr<Extension> extension_3( 958 scoped_refptr<Extension> extension_3(
957 LoadAndExpectSuccess("offline_default_packaged_app.json")); 959 LoadAndExpectSuccess("offline_default_packaged_app.json"));
958 EXPECT_FALSE(extension_3->offline_enabled()); 960 EXPECT_FALSE(extension_3->offline_enabled());
959 scoped_refptr<Extension> extension_4( 961 scoped_refptr<Extension> extension_4(
960 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); 962 LoadAndExpectSuccess("offline_enabled_hosted_app.json"));
961 EXPECT_TRUE(extension_4->offline_enabled()); 963 EXPECT_TRUE(extension_4->offline_enabled());
962 } 964 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | webkit/glue/web_intent_service_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698