| OLD | NEW |
| 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_group.h" | 5 #include "webkit/plugins/npapi/plugin_group.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 TEST(PluginGroupTest, DisableOutdated) { | 175 TEST(PluginGroupTest, DisableOutdated) { |
| 176 PluginGroupDefinition plugindefs[] = { kPluginDef3, kPluginDef34 }; | 176 PluginGroupDefinition plugindefs[] = { kPluginDef3, kPluginDef34 }; |
| 177 for (size_t i = 0; i < 2; ++i) { | 177 for (size_t i = 0; i < 2; ++i) { |
| 178 scoped_ptr<PluginGroup> group(PluginGroupTest::CreatePluginGroup( | 178 scoped_ptr<PluginGroup> group(PluginGroupTest::CreatePluginGroup( |
| 179 plugindefs[i])); | 179 plugindefs[i])); |
| 180 group->AddPlugin(kPlugin3043, 0); | 180 group->AddPlugin(kPlugin3043, 0); |
| 181 group->AddPlugin(kPlugin3045, 1); | 181 group->AddPlugin(kPlugin3045, 1); |
| 182 |
| 182 EXPECT_EQ(ASCIIToUTF16("MyPlugin version 3.0.43"), group->description()); | 183 EXPECT_EQ(ASCIIToUTF16("MyPlugin version 3.0.43"), group->description()); |
| 183 EXPECT_TRUE(group->IsVulnerable()); | 184 EXPECT_TRUE(group->IsVulnerable()); |
| 184 | 185 |
| 185 group->DisableOutdatedPlugins(); | 186 group->DisableOutdatedPlugins(); |
| 186 EXPECT_EQ(ASCIIToUTF16("MyPlugin version 3.0.45"), group->description()); | 187 EXPECT_EQ(ASCIIToUTF16("MyPlugin version 3.0.45"), group->description()); |
| 187 EXPECT_FALSE(group->IsVulnerable()); | 188 EXPECT_FALSE(group->IsVulnerable()); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 TEST(PluginGroupTest, VersionExtraction) { | 192 TEST(PluginGroupTest, VersionExtraction) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 WebPluginInfo silverlight_plugin(ASCIIToUTF16("Silverlight"), | 260 WebPluginInfo silverlight_plugin(ASCIIToUTF16("Silverlight"), |
| 260 FilePath(FILE_PATH_LITERAL("/silver.so")), | 261 FilePath(FILE_PATH_LITERAL("/silver.so")), |
| 261 ASCIIToUTF16("4.0.50917.0"), | 262 ASCIIToUTF16("4.0.50917.0"), |
| 262 ASCIIToUTF16("silverlight 4")); | 263 ASCIIToUTF16("silverlight 4")); |
| 263 group.reset(PluginGroupTest::CreatePluginGroup(silverlight_plugin_def)); | 264 group.reset(PluginGroupTest::CreatePluginGroup(silverlight_plugin_def)); |
| 264 group->AddPlugin(silverlight_plugin, 0); | 265 group->AddPlugin(silverlight_plugin, 0); |
| 265 EXPECT_FALSE(PluginGroup(*group).IsVulnerable()); | 266 EXPECT_FALSE(PluginGroup(*group).IsVulnerable()); |
| 266 } | 267 } |
| 267 } // namespace npapi | 268 } // namespace npapi |
| 268 } // namespace webkit | 269 } // namespace webkit |
| OLD | NEW |