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

Side by Side Diff: chrome/browser/plugins/plugin_prefs_unittest.cc

Issue 19894003: Move webplugininfo.h to content/public. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 "chrome/browser/plugins/plugin_prefs.h" 5 #include "chrome/browser/plugins/plugin_prefs.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/common/chrome_constants.h" 13 #include "chrome/common/chrome_constants.h"
14 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "content/public/browser/plugin_service.h" 15 #include "content/public/browser/plugin_service.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "content/public/common/webplugininfo.h"
17 #include "content/public/test/test_browser_thread.h" 18 #include "content/public/test/test_browser_thread.h"
18 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "webkit/plugins/webplugininfo.h"
21 21
22 using content::BrowserThread; 22 using content::BrowserThread;
23 using content::PluginService; 23 using content::PluginService;
24 24
25 namespace { 25 namespace {
26 26
27 void CanEnablePluginCallback(const base::Closure& quit_closure, 27 void CanEnablePluginCallback(const base::Closure& quit_closure,
28 bool expected_can_change, 28 bool expected_can_change,
29 bool did_change) { 29 bool did_change) {
30 EXPECT_EQ(expected_can_change, did_change); 30 EXPECT_EQ(expected_can_change, did_change);
(...skipping 10 matching lines...) Expand all
41 return path; 41 return path;
42 } 42 }
43 43
44 base::FilePath GetBundledPepperFlashPath() { 44 base::FilePath GetBundledPepperFlashPath() {
45 base::FilePath path; 45 base::FilePath path;
46 EXPECT_TRUE(PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &path)); 46 EXPECT_TRUE(PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &path));
47 return path; 47 return path;
48 } 48 }
49 49
50 void GotPlugins(const base::Closure& quit_closure, 50 void GotPlugins(const base::Closure& quit_closure,
51 const std::vector<webkit::WebPluginInfo>& plugins) { 51 const std::vector<content::WebPluginInfo>& plugins) {
52 quit_closure.Run(); 52 quit_closure.Run();
53 } 53 }
54 54
55 } // namespace 55 } // namespace
56 56
57 class PluginPrefsTest : public ::testing::Test { 57 class PluginPrefsTest : public ::testing::Test {
58 public: 58 public:
59 virtual void SetUp() OVERRIDE { 59 virtual void SetUp() OVERRIDE {
60 plugin_prefs_ = new PluginPrefs(); 60 plugin_prefs_ = new PluginPrefs();
61 } 61 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 TEST_F(PluginPrefsTest, UnifiedPepperFlashState) { 189 TEST_F(PluginPrefsTest, UnifiedPepperFlashState) {
190 base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService. 190 base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService.
191 191
192 base::MessageLoop message_loop; 192 base::MessageLoop message_loop;
193 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 193 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
194 PluginService::GetInstance()->Init(); 194 PluginService::GetInstance()->Init();
195 PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); 195 PluginService::GetInstance()->DisablePluginsDiscoveryForTesting();
196 196
197 string16 component_updated_plugin_name( 197 string16 component_updated_plugin_name(
198 ASCIIToUTF16("Component-updated Pepper Flash")); 198 ASCIIToUTF16("Component-updated Pepper Flash"));
199 webkit::WebPluginInfo component_updated_plugin_1( 199 content::WebPluginInfo component_updated_plugin_1(
200 component_updated_plugin_name, 200 component_updated_plugin_name,
201 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.227")), 201 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.227")),
202 ASCIIToUTF16("11.3.31.227"), 202 ASCIIToUTF16("11.3.31.227"),
203 ASCIIToUTF16("")); 203 ASCIIToUTF16(""));
204 webkit::WebPluginInfo component_updated_plugin_2( 204 content::WebPluginInfo component_updated_plugin_2(
205 component_updated_plugin_name, 205 component_updated_plugin_name,
206 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.228")), 206 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.228")),
207 ASCIIToUTF16("11.3.31.228"), 207 ASCIIToUTF16("11.3.31.228"),
208 ASCIIToUTF16("")); 208 ASCIIToUTF16(""));
209 webkit::WebPluginInfo bundled_plugin(ASCIIToUTF16("Pepper Flash"), 209 content::WebPluginInfo bundled_plugin(ASCIIToUTF16("Pepper Flash"),
210 GetBundledPepperFlashPath(), 210 GetBundledPepperFlashPath(),
211 ASCIIToUTF16("11.3.31.229"), 211 ASCIIToUTF16("11.3.31.229"),
212 ASCIIToUTF16("")); 212 ASCIIToUTF16(""));
213 213
214 PluginService::GetInstance()->RegisterInternalPlugin( 214 PluginService::GetInstance()->RegisterInternalPlugin(
215 component_updated_plugin_1, false); 215 component_updated_plugin_1, false);
216 PluginService::GetInstance()->RegisterInternalPlugin( 216 PluginService::GetInstance()->RegisterInternalPlugin(
217 component_updated_plugin_2, false); 217 component_updated_plugin_2, false);
218 PluginService::GetInstance()->RegisterInternalPlugin(bundled_plugin, false); 218 PluginService::GetInstance()->RegisterInternalPlugin(bundled_plugin, false);
219 219
220 #if !defined(OS_WIN) 220 #if !defined(OS_WIN)
221 // Can't go out of process in unit tests. 221 // Can't go out of process in unit tests.
222 content::RenderProcessHost::SetRunRendererInProcess(true); 222 content::RenderProcessHost::SetRunRendererInProcess(true);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); 268 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2));
269 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); 269 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(bundled_plugin));
270 270
271 EnablePluginSynchronously(true, bundled_plugin.path, true); 271 EnablePluginSynchronously(true, bundled_plugin.path, true);
272 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); 272 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1));
273 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); 273 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2));
274 EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); 274 EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin));
275 } 275 }
276 276
277 #endif 277 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698