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

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

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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_group.cc ('k') | webkit/plugins/npapi/plugin_host.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) 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/glue/plugins/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"
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/glue/plugins/webplugininfo.h" 16 #include "webkit/plugins/npapi/webplugininfo.h"
17 #include "webkit/glue/plugins/plugin_list.h" 17 #include "webkit/plugins/npapi/plugin_list.h"
18
19 namespace webkit {
20 namespace npapi {
18 21
19 static const VersionRangeDefinition kPluginVersionRange[] = { 22 static const VersionRangeDefinition kPluginVersionRange[] = {
20 { "", "", "3.0.44" } 23 { "", "", "3.0.44" }
21 }; 24 };
22 static const VersionRangeDefinition kPlugin3VersionRange[] = { 25 static const VersionRangeDefinition kPlugin3VersionRange[] = {
23 { "0", "4", "3.0.44" } 26 { "0", "4", "3.0.44" }
24 }; 27 };
25 static const VersionRangeDefinition kPlugin4VersionRange[] = { 28 static const VersionRangeDefinition kPlugin4VersionRange[] = {
26 { "4", "5", "4.0.44" } 29 { "4", "5", "4.0.44" }
27 }; 30 };
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 EXPECT_TRUE(group->Match(plugin3045)); 155 EXPECT_TRUE(group->Match(plugin3045));
153 group->AddPlugin(plugin3045, 0); 156 group->AddPlugin(plugin3045, 0);
154 EXPECT_EQ(desc3043, group->description()); 157 EXPECT_EQ(desc3043, group->description());
155 EXPECT_TRUE(group->IsVulnerable()); 158 EXPECT_TRUE(group->IsVulnerable());
156 } 159 }
157 } 160 }
158 } 161 }
159 162
160 TEST(PluginGroupTest, PluginGroupDefinition) { 163 TEST(PluginGroupTest, PluginGroupDefinition) {
161 const PluginGroupDefinition* definitions = 164 const PluginGroupDefinition* definitions =
162 NPAPI::PluginList::GetPluginGroupDefinitions(); 165 PluginList::GetPluginGroupDefinitions();
163 for (size_t i = 0; 166 for (size_t i = 0; i < PluginList::GetPluginGroupDefinitionsSize(); ++i) {
164 i < NPAPI::PluginList::GetPluginGroupDefinitionsSize();
165 ++i) {
166 scoped_ptr<PluginGroup> def_group( 167 scoped_ptr<PluginGroup> def_group(
167 PluginGroupTest::CreatePluginGroup(definitions[i])); 168 PluginGroupTest::CreatePluginGroup(definitions[i]));
168 ASSERT_TRUE(def_group.get() != NULL); 169 ASSERT_TRUE(def_group.get() != NULL);
169 EXPECT_FALSE(def_group->Match(kPlugin2043)); 170 EXPECT_FALSE(def_group->Match(kPlugin2043));
170 } 171 }
171 } 172 }
172 173
173 TEST(PluginGroupTest, DisableOutdated) { 174 TEST(PluginGroupTest, DisableOutdated) {
174 PluginGroupDefinition plugindefs[] = { kPluginDef3, kPluginDef34 }; 175 PluginGroupDefinition plugindefs[] = { kPluginDef3, kPluginDef34 };
175 for (size_t i = 0; i < 2; ++i) { 176 for (size_t i = 0; i < 2; ++i) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 disabled_plugins.insert(ASCIIToUTF16("Disable this!")); 216 disabled_plugins.insert(ASCIIToUTF16("Disable this!"));
216 disabled_plugins.insert(ASCIIToUTF16("*Google*")); 217 disabled_plugins.insert(ASCIIToUTF16("*Google*"));
217 PluginGroup::SetPolicyDisabledPluginPatterns(disabled_plugins); 218 PluginGroup::SetPolicyDisabledPluginPatterns(disabled_plugins);
218 219
219 EXPECT_FALSE(PluginGroup::IsPluginNameDisabledByPolicy(ASCIIToUTF16("42"))); 220 EXPECT_FALSE(PluginGroup::IsPluginNameDisabledByPolicy(ASCIIToUTF16("42")));
220 EXPECT_TRUE(PluginGroup::IsPluginNameDisabledByPolicy( 221 EXPECT_TRUE(PluginGroup::IsPluginNameDisabledByPolicy(
221 ASCIIToUTF16("Disable this!"))); 222 ASCIIToUTF16("Disable this!")));
222 EXPECT_TRUE(PluginGroup::IsPluginNameDisabledByPolicy( 223 EXPECT_TRUE(PluginGroup::IsPluginNameDisabledByPolicy(
223 ASCIIToUTF16("Google Earth"))); 224 ASCIIToUTF16("Google Earth")));
224 } 225 }
226
227 } // namespace npapi
228 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_group.cc ('k') | webkit/plugins/npapi/plugin_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698