Chromium Code Reviews| Index: chrome/browser/plugins/plugin_prefs_unittest.cc |
| =================================================================== |
| --- chrome/browser/plugins/plugin_prefs_unittest.cc (revision 212185) |
| +++ chrome/browser/plugins/plugin_prefs_unittest.cc (working copy) |
| @@ -14,8 +14,8 @@ |
| #include "chrome/common/chrome_paths.h" |
| #include "content/public/browser/plugin_service.h" |
| #include "content/public/test/test_browser_thread.h" |
| +#include "content/public/test/test_utils.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -#include "webkit/plugins/npapi/mock_plugin_list.h" |
| #include "webkit/plugins/webplugininfo.h" |
| using content::BrowserThread; |
| @@ -46,6 +46,11 @@ |
| return path; |
| } |
| +void GotPlugins(const base::Closure& quit_closure, |
| + const std::vector<webkit::WebPluginInfo>& plugins) { |
| + quit_closure.Run(); |
| +} |
| + |
| } // namespace |
| class PluginPrefsTest : public ::testing::Test { |
| @@ -182,9 +187,8 @@ |
| base::MessageLoop message_loop; |
| content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
| - webkit::npapi::MockPluginList plugin_list; |
| - PluginService::GetInstance()->SetPluginListForTesting(&plugin_list); |
| PluginService::GetInstance()->Init(); |
| + PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); |
| string16 component_updated_plugin_name( |
| ASCIIToUTF16("Component-updated Pepper Flash")); |
| @@ -203,10 +207,18 @@ |
| ASCIIToUTF16("11.3.31.229"), |
| ASCIIToUTF16("")); |
| - plugin_list.AddPluginToLoad(component_updated_plugin_1); |
| - plugin_list.AddPluginToLoad(component_updated_plugin_2); |
| - plugin_list.AddPluginToLoad(bundled_plugin); |
| + PluginService::GetInstance()->RegisterInternalPlugin( |
| + component_updated_plugin_1, false); |
| + PluginService::GetInstance()->RegisterInternalPlugin( |
| + component_updated_plugin_2, false); |
| + PluginService::GetInstance()->RegisterInternalPlugin(bundled_plugin, false); |
| + scoped_refptr<content::MessageLoopRunner> runner = |
|
scottmg
2013/07/18 00:33:09
was this previously a bug?
jam
2013/07/18 00:36:35
When MockPlugin was used, plugins were available i
|
| + new content::MessageLoopRunner; |
| + PluginService::GetInstance()->GetPlugins( |
| + base::Bind(&GotPlugins, runner->QuitClosure())); |
| + runner->Run(); |
| + |
| // Set the state of any of the three plugins will affect the others. |
| EnablePluginSynchronously(true, component_updated_plugin_1.path, true); |
| EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); |
| @@ -249,6 +261,4 @@ |
| EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); |
| EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); |
| EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); |
| - |
| - PluginService::GetInstance()->SetPluginListForTesting(NULL); |
| } |