| OLD | NEW |
| 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/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 // Linux Aura doesn't support NPAPI. | 202 // Linux Aura doesn't support NPAPI. |
| 203 #if !(defined(OS_LINUX) && defined(USE_AURA)) | 203 #if !(defined(OS_LINUX) && defined(USE_AURA)) |
| 204 | 204 |
| 205 TEST_F(PluginPrefsTest, UnifiedPepperFlashState) { | 205 TEST_F(PluginPrefsTest, UnifiedPepperFlashState) { |
| 206 content::TestBrowserThreadBundle browser_threads; | 206 content::TestBrowserThreadBundle browser_threads; |
| 207 base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService. | 207 base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService. |
| 208 | 208 |
| 209 PluginService::GetInstance()->Init(); | 209 PluginService::GetInstance()->Init(); |
| 210 PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); | 210 PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); |
| 211 PluginService::GetInstance()->EnableNpapiPluginsForTesting(); | |
| 212 | 211 |
| 213 base::string16 component_updated_plugin_name( | 212 base::string16 component_updated_plugin_name( |
| 214 ASCIIToUTF16("Component-updated Pepper Flash")); | 213 ASCIIToUTF16("Component-updated Pepper Flash")); |
| 215 content::WebPluginInfo component_updated_plugin_1( | 214 content::WebPluginInfo component_updated_plugin_1( |
| 216 component_updated_plugin_name, | 215 component_updated_plugin_name, |
| 217 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.227")), | 216 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.227")), |
| 218 ASCIIToUTF16("11.3.31.227"), | 217 ASCIIToUTF16("11.3.31.227"), |
| 219 ASCIIToUTF16("")); | 218 ASCIIToUTF16("")); |
| 220 content::WebPluginInfo component_updated_plugin_2( | 219 content::WebPluginInfo component_updated_plugin_2( |
| 221 component_updated_plugin_name, | 220 component_updated_plugin_name, |
| 222 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.228")), | 221 GetComponentUpdatedPepperFlashPath(FILE_PATH_LITERAL("11.3.31.228")), |
| 223 ASCIIToUTF16("11.3.31.228"), | 222 ASCIIToUTF16("11.3.31.228"), |
| 224 ASCIIToUTF16("")); | 223 ASCIIToUTF16("")); |
| 225 content::WebPluginInfo bundled_plugin(ASCIIToUTF16("Pepper Flash"), | 224 content::WebPluginInfo bundled_plugin(ASCIIToUTF16("Pepper Flash"), |
| 226 GetBundledPepperFlashPath(), | 225 GetBundledPepperFlashPath(), |
| 227 ASCIIToUTF16("11.3.31.229"), | 226 ASCIIToUTF16("11.3.31.229"), |
| 228 ASCIIToUTF16("")); | 227 ASCIIToUTF16("")); |
| 228 component_updated_plugin_1.type = |
| 229 content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; |
| 230 component_updated_plugin_2.type = |
| 231 content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; |
| 232 bundled_plugin.type = |
| 233 content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; |
| 229 | 234 |
| 230 PluginService::GetInstance()->RegisterInternalPlugin( | 235 PluginService::GetInstance()->RegisterInternalPlugin( |
| 231 component_updated_plugin_1, false); | 236 component_updated_plugin_1, false); |
| 232 PluginService::GetInstance()->RegisterInternalPlugin( | 237 PluginService::GetInstance()->RegisterInternalPlugin( |
| 233 component_updated_plugin_2, false); | 238 component_updated_plugin_2, false); |
| 234 PluginService::GetInstance()->RegisterInternalPlugin(bundled_plugin, false); | 239 PluginService::GetInstance()->RegisterInternalPlugin(bundled_plugin, false); |
| 235 | 240 |
| 236 RefreshPluginsSynchronously(); | 241 RefreshPluginsSynchronously(); |
| 237 | 242 |
| 238 // Set the state of any of the three plugins will affect the others. | 243 // Set the state of any of the three plugins will affect the others. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); | 278 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); |
| 274 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); | 279 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); |
| 275 | 280 |
| 276 EnablePluginSynchronously(true, bundled_plugin.path, true); | 281 EnablePluginSynchronously(true, bundled_plugin.path, true); |
| 277 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); | 282 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); |
| 278 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); | 283 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); |
| 279 EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); | 284 EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); |
| 280 } | 285 } |
| 281 | 286 |
| 282 #endif | 287 #endif |
| OLD | NEW |