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

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

Issue 19706002: Remove plugin_list.h includes from chrome tests in preparation for moving webkit/plugins to content… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/plugins/npapi/mock_plugin_list.h"
11 10
12 namespace webkit { 11 namespace webkit {
13 namespace npapi { 12 namespace npapi {
14 13
15 namespace { 14 namespace {
16 15
17 bool Equals(const WebPluginInfo& a, const WebPluginInfo& b) { 16 bool Equals(const WebPluginInfo& a, const WebPluginInfo& b) {
18 return (a.name == b.name && 17 return (a.name == b.name &&
19 a.path == b.path && 18 a.path == b.path &&
20 a.version == b.version && 19 a.version == b.version &&
(...skipping 23 matching lines...) Expand all
44 base::FilePath(kFooPath), 43 base::FilePath(kFooPath),
45 ASCIIToUTF16("1.2.3"), 44 ASCIIToUTF16("1.2.3"),
46 ASCIIToUTF16("foo")), 45 ASCIIToUTF16("foo")),
47 bar_plugin_(ASCIIToUTF16("Bar Plugin"), 46 bar_plugin_(ASCIIToUTF16("Bar Plugin"),
48 base::FilePath(kBarPath), 47 base::FilePath(kBarPath),
49 ASCIIToUTF16("2.3.4"), 48 ASCIIToUTF16("2.3.4"),
50 ASCIIToUTF16("bar")) { 49 ASCIIToUTF16("bar")) {
51 } 50 }
52 51
53 virtual void SetUp() { 52 virtual void SetUp() {
54 plugin_list_.AddPluginToLoad(bar_plugin_); 53 plugin_list_.DisablePluginsDiscovery();
55 plugin_list_.AddPluginToLoad(foo_plugin_); 54 plugin_list_.RegisterInternalPlugin(bar_plugin_, false);
55 plugin_list_.RegisterInternalPlugin(foo_plugin_, false);
56 } 56 }
57 57
58 protected: 58 protected:
59 MockPluginList plugin_list_; 59 PluginList plugin_list_;
60 WebPluginInfo foo_plugin_; 60 WebPluginInfo foo_plugin_;
61 WebPluginInfo bar_plugin_; 61 WebPluginInfo bar_plugin_;
62 }; 62 };
63 63
64 TEST_F(PluginListTest, GetPlugins) { 64 TEST_F(PluginListTest, GetPlugins) {
65 std::vector<WebPluginInfo> plugins; 65 std::vector<WebPluginInfo> plugins;
66 plugin_list_.GetPlugins(&plugins); 66 plugin_list_.GetPlugins(&plugins);
67 EXPECT_EQ(2u, plugins.size()); 67 EXPECT_EQ(2u, plugins.size());
68 EXPECT_TRUE(Contains(plugins, foo_plugin_)); 68 EXPECT_TRUE(Contains(plugins, foo_plugin_));
69 EXPECT_TRUE(Contains(plugins, bar_plugin_)); 69 EXPECT_TRUE(Contains(plugins, bar_plugin_));
70 } 70 }
71 71
72 TEST_F(PluginListTest, BadPluginDescription) { 72 TEST_F(PluginListTest, BadPluginDescription) {
73 WebPluginInfo plugin_3043( 73 WebPluginInfo plugin_3043(
74 base::string16(), base::FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), 74 base::string16(), base::FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),
75 base::string16(), base::string16()); 75 base::string16(), base::string16());
76 // Simulate loading of the plugins. 76 // Simulate loading of the plugins.
77 plugin_list_.ClearPluginsToLoad(); 77 plugin_list_.RegisterInternalPlugin(plugin_3043, false);
78 plugin_list_.AddPluginToLoad(plugin_3043);
79 // Now we should have them in the state we specified above. 78 // Now we should have them in the state we specified above.
80 plugin_list_.RefreshPlugins(); 79 plugin_list_.RefreshPlugins();
81 std::vector<WebPluginInfo> plugins; 80 std::vector<WebPluginInfo> plugins;
82 plugin_list_.GetPlugins(&plugins); 81 plugin_list_.GetPlugins(&plugins);
83 ASSERT_TRUE(Contains(plugins, plugin_3043)); 82 ASSERT_TRUE(Contains(plugins, plugin_3043));
84 } 83 }
85 84
86 #if defined(OS_POSIX) && !defined(OS_MACOSX) 85 #if defined(OS_POSIX) && !defined(OS_MACOSX)
87 86
88 // Test parsing a simple description: Real Audio. 87 // Test parsing a simple description: Real Audio.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 "(using IcedTea-Web 1.2 (1.2-2ubuntu0.10.04.2))", 189 "(using IcedTea-Web 1.2 (1.2-2ubuntu0.10.04.2))",
191 &info); 190 &info);
192 EXPECT_EQ(ASCIIToUTF16("1.2"), info.version); 191 EXPECT_EQ(ASCIIToUTF16("1.2"), info.version);
193 } 192 }
194 193
195 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 194 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
196 195
197 196
198 } // namespace npapi 197 } // namespace npapi
199 } // namespace webkit 198 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698