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

Side by Side Diff: webkit/plugins/npapi/plugin_list_unittest.cc

Issue 6324014: Fixed grave bug in Plugin Loading code that lead to a crash with some plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | « webkit/plugins/npapi/plugin_list.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_list.h" 5 #include "webkit/plugins/npapi/plugin_list.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace webkit { 10 namespace webkit {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 EXPECT_EQ(group_3043, group_3045); 175 EXPECT_EQ(group_3043, group_3045);
176 group_3043->version_ranges_.push_back(VersionRange(version_range[0])); 176 group_3043->version_ranges_.push_back(VersionRange(version_range[0]));
177 group_3043->version_ranges_.push_back(VersionRange(version_range[1])); 177 group_3043->version_ranges_.push_back(VersionRange(version_range[1]));
178 EXPECT_EQ(plugin_3043.desc, group_3043->description()); 178 EXPECT_EQ(plugin_3043.desc, group_3043->description());
179 EXPECT_TRUE(group_3043->IsVulnerable()); 179 EXPECT_TRUE(group_3043->IsVulnerable());
180 group_3043->DisableOutdatedPlugins(); 180 group_3043->DisableOutdatedPlugins();
181 EXPECT_EQ(plugin_3045.desc, group_3043->description()); 181 EXPECT_EQ(plugin_3045.desc, group_3043->description());
182 EXPECT_FALSE(group_3043->IsVulnerable()); 182 EXPECT_FALSE(group_3043->IsVulnerable());
183 } 183 }
184 184
185 TEST_F(PluginListTest, BadPluginDescription) {
186 WebPluginInfo plugin_3043(ASCIIToUTF16(""),
187 FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),
188 ASCIIToUTF16(""),
189 ASCIIToUTF16(""));
190 // Simulate loading of the plugins.
191 plugin_list_.plugins_to_load_.clear();
192 plugin_list_.plugins_to_load_.push_back(plugin_3043);
193 // Now we should have them in the state we specified above.
194 std::vector<WebPluginInfo> plugins;
195 plugin_list_.GetPlugins(true, &plugins);
196 ASSERT_TRUE(Contains(plugins, plugin_3043, true));
197 }
198
185 TEST_F(PluginListTest, DisableAndEnableBeforeLoad) { 199 TEST_F(PluginListTest, DisableAndEnableBeforeLoad) {
186 WebPluginInfo plugin_3043(ASCIIToUTF16("MyPlugin"), 200 WebPluginInfo plugin_3043(ASCIIToUTF16("MyPlugin"),
187 FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), 201 FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),
188 ASCIIToUTF16("3.0.43"), 202 ASCIIToUTF16("3.0.43"),
189 ASCIIToUTF16("MyPlugin version 3.0.43")); 203 ASCIIToUTF16("MyPlugin version 3.0.43"));
190 WebPluginInfo plugin_3045(ASCIIToUTF16("MyPlugin"), 204 WebPluginInfo plugin_3045(ASCIIToUTF16("MyPlugin"),
191 FilePath(FILE_PATH_LITERAL("/myplugin.3.0.45")), 205 FilePath(FILE_PATH_LITERAL("/myplugin.3.0.45")),
192 ASCIIToUTF16("3.0.45"), 206 ASCIIToUTF16("3.0.45"),
193 ASCIIToUTF16("MyPlugin version 3.0.45")); 207 ASCIIToUTF16("MyPlugin version 3.0.45"));
194 // Disable the first one and disable and then enable the second one. 208 // Disable the first one and disable and then enable the second one.
195 EXPECT_TRUE(plugin_list_.DisablePlugin(plugin_3043.path)); 209 EXPECT_TRUE(plugin_list_.DisablePlugin(plugin_3043.path));
196 EXPECT_TRUE(plugin_list_.DisablePlugin(plugin_3045.path)); 210 EXPECT_TRUE(plugin_list_.DisablePlugin(plugin_3045.path));
197 EXPECT_TRUE(plugin_list_.EnablePlugin(plugin_3045.path)); 211 EXPECT_TRUE(plugin_list_.EnablePlugin(plugin_3045.path));
198 // Simulate loading of the plugins. 212 // Simulate loading of the plugins.
199 plugin_list_.plugins_to_load_.clear(); 213 plugin_list_.plugins_to_load_.clear();
200 plugin_list_.plugins_to_load_.push_back(plugin_3043); 214 plugin_list_.plugins_to_load_.push_back(plugin_3043);
201 plugin_list_.plugins_to_load_.push_back(plugin_3045); 215 plugin_list_.plugins_to_load_.push_back(plugin_3045);
202 // Now we should have them in the state we specified above. 216 // Now we should have them in the state we specified above.
203 std::vector<WebPluginInfo> plugins; 217 std::vector<WebPluginInfo> plugins;
204 plugin_list_.GetPlugins(true, &plugins); 218 plugin_list_.GetPlugins(true, &plugins);
205 plugin_3043.enabled = WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; 219 plugin_3043.enabled = WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED;
206 ASSERT_TRUE(Contains(plugins, plugin_3043, true)); 220 ASSERT_TRUE(Contains(plugins, plugin_3043, true));
207 ASSERT_TRUE(Contains(plugins, plugin_3045, true)); 221 ASSERT_TRUE(Contains(plugins, plugin_3045, true));
208 } 222 }
209 223
210 } // namespace npapi 224 } // namespace npapi
211 } // namespace webkit 225 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698