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

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

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

Powered by Google App Engine
This is Rietveld 408576698