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

Unified Diff: chrome/browser/plugins/plugin_prefs_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: fix posix tests 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 side-by-side diff with in-line comments
Download patch
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)
@@ -13,9 +13,10 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/plugin_service.h"
+#include "content/public/browser/render_process_host.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 +47,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 {
@@ -177,14 +183,16 @@
plugin_prefs_->PolicyStatusForPlugin(k42));
}
+// Linux Aura doesn't support NPAPI.
+#if !(defined(OS_LINUX) && defined(USE_AURA))
+
TEST_F(PluginPrefsTest, UnifiedPepperFlashState) {
base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService.
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 +211,25 @@
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);
+#if !defined(OS_WIN)
+ // Can't go out of process in unit tests.
+ content::RenderProcessHost::SetRunRendererInProcess(true);
+#endif
+ scoped_refptr<content::MessageLoopRunner> runner =
+ new content::MessageLoopRunner;
+ PluginService::GetInstance()->GetPlugins(
+ base::Bind(&GotPlugins, runner->QuitClosure()));
+ runner->Run();
+#if !defined(OS_WIN)
+ content::RenderProcessHost::SetRunRendererInProcess(false);
+#endif
+
// 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 +272,6 @@
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);
-}
+#endif
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/printing/print_preview_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698