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

Unified Diff: chrome/browser/chromeos/gview_request_interceptor_unittest.cc

Issue 8071013: Finish moving plugin probing out of process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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/chromeos/gview_request_interceptor_unittest.cc
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
index 33662b7e9d5b9c28c80da51514125948d19e8750..6d0b564f5586e3dff9391d3c0c16cc1cc0132315 100644
--- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
@@ -4,6 +4,7 @@
#include <string>
+#include "base/bind.h"
#include "base/message_loop.h"
#include "chrome/browser/chrome_plugin_service_filter.h"
#include "chrome/browser/chromeos/gview_request_interceptor.h"
@@ -67,6 +68,10 @@ class GViewRequestProtocolFactory
}
};
+void QuitMessageLoop(const std::vector<webkit::WebPluginInfo>&) {
+ MessageLoop::current()->Quit();
+}
+
class GViewRequestInterceptorTest : public testing::Test {
public:
GViewRequestInterceptorTest()
@@ -109,33 +114,41 @@ class GViewRequestInterceptorTest : public testing::Test {
PluginService::GetInstance()->set_filter(NULL);
}
+ // GetPluginInfoByPath() will only use stale information. Because plugin
+ // refresh is asynchronous, spin a MessageLoop until the callback is run,
+ // after which, the test will continue.
void RegisterPDFPlugin() {
webkit::WebPluginInfo info;
info.path = pdf_path_;
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info);
- webkit::npapi::PluginList::Singleton()->RefreshPlugins();
+
+ PluginService::GetInstance()->RefreshPluginList();
+ PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop));
+ MessageLoop::current()->Run();
}
void UnregisterPDFPlugin() {
webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_);
- webkit::npapi::PluginList::Singleton()->RefreshPlugins();
+
+ PluginService::GetInstance()->RefreshPluginList();
+ PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop));
+ MessageLoop::current()->Run();
}
void SetPDFPluginLoadedState(bool want_loaded) {
webkit::WebPluginInfo info;
- bool is_loaded =
- webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath(
- pdf_path_, &info);
+ bool is_loaded = PluginService::GetInstance()->GetPluginInfoByPath(
+ pdf_path_, &info);
if (is_loaded && !want_loaded) {
UnregisterPDFPlugin();
- is_loaded = webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath(
+ is_loaded = PluginService::GetInstance()->GetPluginInfoByPath(
pdf_path_, &info);
} else if (!is_loaded && want_loaded) {
// This "loads" the plug-in even if it's not present on the
// system - which is OK since we don't actually use it, just
// need it to be "enabled" for the test.
RegisterPDFPlugin();
- is_loaded = webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath(
+ is_loaded = PluginService::GetInstance()->GetPluginInfoByPath(
pdf_path_, &info);
}
EXPECT_EQ(want_loaded, is_loaded);

Powered by Google App Engine
This is Rietveld 408576698