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

Unified Diff: content/browser/plugin_service_browsertest.cc

Issue 7477044: Use PluginPrefs in ChromePluginServiceFilter to check whether a plugin is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 4 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
« no previous file with comments | « content/browser/plugin_service.cc ('k') | content/browser/plugin_service_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/plugin_service_browsertest.cc
diff --git a/content/browser/plugin_service_browsertest.cc b/content/browser/plugin_service_browsertest.cc
index e1e15b72983c78f3c3a439db8feecb25453e7823..323d8b49bf100fd9d3e83dea4a0d7fa4e398372d 100644
--- a/content/browser/plugin_service_browsertest.cc
+++ b/content/browser/plugin_service_browsertest.cc
@@ -9,6 +9,7 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/browser_thread.h"
+#include "content/browser/resource_context.h"
#include "content/common/content_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "webkit/plugins/npapi/plugin_list.h"
@@ -17,6 +18,15 @@ namespace {
const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test";
+class MockResourceContext : public content::ResourceContext {
+ public:
+ MockResourceContext() {}
+ virtual ~MockResourceContext() {}
+
+ private:
+ virtual void EnsureInitialized() const OVERRIDE {}
+};
+
// Mock up of the Client and the Listener classes that would supply the
// communication channel with the plugin.
class MockPluginProcessHostClient : public PluginProcessHost::Client,
@@ -33,8 +43,11 @@ class MockPluginProcessHostClient : public PluginProcessHost::Client,
}
// Client implementation.
- int ID() { return 42; }
- bool OffTheRecord() { return false; }
+ virtual int ID() OVERRIDE { return 42; }
+ virtual bool OffTheRecord() OVERRIDE { return false; }
+ virtual const content::ResourceContext& GetResourceContext() OVERRIDE {
+ return context_;
+ }
void OnChannelOpened(const IPC::ChannelHandle& handle) {
ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -63,6 +76,7 @@ class MockPluginProcessHostClient : public PluginProcessHost::Client,
MOCK_METHOD0(OnChannelListenError, void());
private:
+ MockResourceContext context_;
IPC::Channel* channel_;
bool set_plugin_info_called_;
DISALLOW_COPY_AND_ASSIGN(MockPluginProcessHostClient);
@@ -82,13 +96,20 @@ class PluginServiceTest : public InProcessBrowserTest {
browser_directory.AppendASCII("plugins"));
#endif
}
+
+ static void OpenChannelOnIOThread(PluginProcessHost::Client* client) {
+ PluginService::GetInstance()->OpenChannelToNpapiPlugin(
+ 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client);
+ }
};
// Try to open a channel to the test plugin. Minimal plugin process spawning
// test for the PluginService interface.
IN_PROC_BROWSER_TEST_F(PluginServiceTest, OpenChannelToPlugin) {
- MockPluginProcessHostClient mock_client;
- PluginService::GetInstance()->OpenChannelToNpapiPlugin(
- 0, 0, GURL(), kNPAPITestPluginMimeType, &mock_client);
+ ::testing::StrictMock<MockPluginProcessHostClient> mock_client;
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ NewRunnableFunction(&PluginServiceTest::OpenChannelOnIOThread,
+ &mock_client));
ui_test_utils::RunMessageLoop();
}
« no previous file with comments | « content/browser/plugin_service.cc ('k') | content/browser/plugin_service_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698