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 "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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "webkit/plugins/npapi/webplugininfo.h" | 16 #include "webkit/plugins/webplugininfo.h" |
17 | 17 |
18 namespace webkit { | 18 namespace webkit { |
19 namespace npapi { | 19 namespace npapi { |
20 | 20 |
21 static const VersionRangeDefinition kPluginVersionRange[] = { | 21 static const VersionRangeDefinition kPluginVersionRange[] = { |
22 { "", "", "3.0.44", false } | 22 { "", "", "3.0.44", false } |
23 }; | 23 }; |
24 static const VersionRangeDefinition kPlugin3VersionRange[] = { | 24 static const VersionRangeDefinition kPlugin3VersionRange[] = { |
25 { "0", "4", "3.0.44", false } | 25 { "0", "4", "3.0.44", false } |
26 }; | 26 }; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 EXPECT_EQ(desc3043, group->description()); | 143 EXPECT_EQ(desc3043, group->description()); |
144 EXPECT_TRUE(group->IsVulnerable()); | 144 EXPECT_TRUE(group->IsVulnerable()); |
145 EXPECT_TRUE(group->Match(plugin3045)); | 145 EXPECT_TRUE(group->Match(plugin3045)); |
146 group->AddPlugin(plugin3045); | 146 group->AddPlugin(plugin3045); |
147 EXPECT_EQ(desc3043, group->description()); | 147 EXPECT_EQ(desc3043, group->description()); |
148 EXPECT_TRUE(group->IsVulnerable()); | 148 EXPECT_TRUE(group->IsVulnerable()); |
149 } | 149 } |
150 { | 150 { |
151 // Disable the second plugin. | 151 // Disable the second plugin. |
152 plugin3045.enabled = | 152 plugin3045.enabled = |
153 webkit::npapi::WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; | 153 webkit::WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; |
154 scoped_ptr<PluginGroup> group(PluginGroupTest::CreatePluginGroup( | 154 scoped_ptr<PluginGroup> group(PluginGroupTest::CreatePluginGroup( |
155 plugindefs[i])); | 155 plugindefs[i])); |
156 EXPECT_TRUE(group->Match(plugin3043)); | 156 EXPECT_TRUE(group->Match(plugin3043)); |
157 group->AddPlugin(plugin3043); | 157 group->AddPlugin(plugin3043); |
158 EXPECT_EQ(desc3043, group->description()); | 158 EXPECT_EQ(desc3043, group->description()); |
159 EXPECT_TRUE(group->IsVulnerable()); | 159 EXPECT_TRUE(group->IsVulnerable()); |
160 EXPECT_TRUE(group->Match(plugin3045)); | 160 EXPECT_TRUE(group->Match(plugin3045)); |
161 group->AddPlugin(plugin3045); | 161 group->AddPlugin(plugin3045); |
162 EXPECT_EQ(desc3043, group->description()); | 162 EXPECT_EQ(desc3043, group->description()); |
163 EXPECT_TRUE(group->IsVulnerable()); | 163 EXPECT_TRUE(group->IsVulnerable()); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 EXPECT_EQ(kPlugin3043.desc, group->description()); | 406 EXPECT_EQ(kPlugin3043.desc, group->description()); |
407 EXPECT_TRUE(group->IsVulnerable()); | 407 EXPECT_TRUE(group->IsVulnerable()); |
408 | 408 |
409 EXPECT_TRUE(group->RemovePlugin(kPlugin3043.path)); | 409 EXPECT_TRUE(group->RemovePlugin(kPlugin3043.path)); |
410 EXPECT_TRUE(group->IsEmpty()); | 410 EXPECT_TRUE(group->IsEmpty()); |
411 EXPECT_EQ(string16(), group->description()); | 411 EXPECT_EQ(string16(), group->description()); |
412 } | 412 } |
413 | 413 |
414 } // namespace npapi | 414 } // namespace npapi |
415 } // namespace webkit | 415 } // namespace webkit |
OLD | NEW |