Index: chrome/browser/plugin_prefs_unittest.cc |
diff --git a/chrome/browser/plugin_prefs_unittest.cc b/chrome/browser/plugin_prefs_unittest.cc |
index 20acd5e509cba51b5e4f96e6d61a85a75adcc258..bad70ea5f90a152736963326614018be6a8ed855 100644 |
--- a/chrome/browser/plugin_prefs_unittest.cc |
+++ b/chrome/browser/plugin_prefs_unittest.cc |
@@ -4,10 +4,14 @@ |
#include "chrome/browser/plugin_prefs.h" |
+#include "base/at_exit.h" |
+#include "base/bind.h" |
+#include "base/message_loop.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/test/base/testing_browser_process.h" |
#include "chrome/test/base/testing_profile.h" |
#include "chrome/test/base/testing_profile_manager.h" |
+#include "content/browser/plugin_service.h" |
#include "content/test/test_browser_thread.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "webkit/plugins/npapi/mock_plugin_list.cc" |
@@ -30,6 +34,8 @@ class PluginPrefsTest : public ::testing::Test { |
} |
protected: |
+ base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService. |
Bernhard Bauer
2011/11/10 23:19:24
You could move this down to PluginPrefsTest.Disabl
Robert Sesek
2011/11/10 23:25:39
Done.
|
+ |
scoped_refptr<PluginPrefs> plugin_prefs_; |
}; |
@@ -138,6 +144,10 @@ TEST_F(PluginPrefsTest, DisableGlobally) { |
content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop); |
+ webkit::npapi::MockPluginList plugin_list(NULL, 0); |
+ PluginService::GetInstance()->SetPluginListForTesting(&plugin_list); |
+ PluginService::GetInstance()->Init(); |
+ |
TestingBrowserProcess* browser_process = |
static_cast<TestingBrowserProcess*>(g_browser_process); |
TestingProfileManager profile_manager(browser_process); |
@@ -147,16 +157,17 @@ TEST_F(PluginPrefsTest, DisableGlobally) { |
profile_manager.CreateTestingProfile("Profile 1"); |
PluginPrefs* plugin_prefs = PluginPrefs::GetForTestingProfile(profile_1); |
ASSERT_TRUE(plugin_prefs); |
+ plugin_prefs->SetPluginListForTesting(&plugin_list); |
webkit::WebPluginInfo plugin(ASCIIToUTF16("Foo"), |
FilePath(FILE_PATH_LITERAL("/path/too/foo")), |
ASCIIToUTF16("1.0.0"), |
ASCIIToUTF16("Foo plug-in")); |
- webkit::npapi::MockPluginList plugin_list(NULL, 0); |
plugin_list.AddPluginToLoad(plugin); |
- plugin_prefs->SetPluginListForTesting(&plugin_list); |
EXPECT_TRUE(PluginPrefs::EnablePluginGlobally(false, plugin.path)); |
+ message_loop.RunAllPending(); |
+ |
EXPECT_FALSE(plugin_prefs->IsPluginEnabled(plugin)); |
TestingProfile* profile_2 = |
@@ -165,4 +176,7 @@ TEST_F(PluginPrefsTest, DisableGlobally) { |
ASSERT_TRUE(plugin_prefs); |
plugin_prefs_2->SetPluginListForTesting(&plugin_list); |
EXPECT_FALSE(plugin_prefs_2->IsPluginEnabled(plugin)); |
+ |
+ profile_manager.DeleteTestingProfile("Profile 1"); |
+ profile_manager.DeleteTestingProfile("Profile 2"); |
} |