OLD | NEW |
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 "webkit/plugins/npapi/plugin_lib.h" | 5 #include "webkit/plugins/npapi/plugin_lib.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 std::vector<WebPluginMimeType> types; | 118 std::vector<WebPluginMimeType> types; |
119 PluginLib::ParseMIMEDescription("mime/type:", &types); | 119 PluginLib::ParseMIMEDescription("mime/type:", &types); |
120 EXPECT_TRUE(types.empty()); | 120 EXPECT_TRUE(types.empty()); |
121 | 121 |
122 types.clear(); | 122 types.clear(); |
123 PluginLib::ParseMIMEDescription("mime/type:ext1:", &types); | 123 PluginLib::ParseMIMEDescription("mime/type:ext1:", &types); |
124 ASSERT_EQ(1U, types.size()); | 124 ASSERT_EQ(1U, types.size()); |
125 EXPECT_EQ("mime/type", types[0].mime_type); | 125 EXPECT_EQ("mime/type", types[0].mime_type); |
126 EXPECT_EQ(1U, types[0].file_extensions.size()); | 126 EXPECT_EQ(1U, types[0].file_extensions.size()); |
127 EXPECT_EQ("ext1", types[0].file_extensions[0]); | 127 EXPECT_EQ("ext1", types[0].file_extensions[0]); |
128 EXPECT_EQ(string16(), types[0].description); | 128 EXPECT_EQ(base::string16(), types[0].description); |
129 } | 129 } |
130 | 130 |
131 // This Java plugin has embedded semicolons in the mime type. | 131 // This Java plugin has embedded semicolons in the mime type. |
132 TEST(MIMEDescriptionParse, ComplicatedJava) { | 132 TEST(MIMEDescriptionParse, ComplicatedJava) { |
133 std::vector<WebPluginMimeType> types; | 133 std::vector<WebPluginMimeType> types; |
134 PluginLib::ParseMIMEDescription( | 134 PluginLib::ParseMIMEDescription( |
135 "application/x-java-vm:class,jar:IcedTea;application/x-java" | 135 "application/x-java-vm:class,jar:IcedTea;application/x-java" |
136 "-applet:class,jar:IcedTea;application/x-java-applet;versio" | 136 "-applet:class,jar:IcedTea;application/x-java-applet;versio" |
137 "n=1.1:class,jar:IcedTea;application/x-java-applet;version=" | 137 "n=1.1:class,jar:IcedTea;application/x-java-applet;version=" |
138 "1.1.1:class,jar:IcedTea;application/x-java-applet;version=" | 138 "1.1.1:class,jar:IcedTea;application/x-java-applet;version=" |
(...skipping 29 matching lines...) Expand all Loading... |
168 "IcedTea-Web Plugin " | 168 "IcedTea-Web Plugin " |
169 "(using IcedTea-Web 1.2 (1.2-2ubuntu0.10.04.2))", | 169 "(using IcedTea-Web 1.2 (1.2-2ubuntu0.10.04.2))", |
170 &info); | 170 &info); |
171 EXPECT_EQ(ASCIIToUTF16("1.2"), info.version); | 171 EXPECT_EQ(ASCIIToUTF16("1.2"), info.version); |
172 } | 172 } |
173 | 173 |
174 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 174 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
175 | 175 |
176 } // namespace npapi | 176 } // namespace npapi |
177 } // namespace webkit | 177 } // namespace webkit |
OLD | NEW |