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

Unified Diff: content/test/mock_plugin_service.cc

Issue 8493019: Refactor PluginService to take PluginList as a dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« content/test/mock_plugin_service.h ('K') | « content/test/mock_plugin_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/mock_plugin_service.cc
diff --git a/content/test/mock_plugin_service.cc b/content/test/mock_plugin_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..71425cbf5a99a0fe5872f2b74b01f94160db3920
--- /dev/null
+++ b/content/test/mock_plugin_service.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/test/mock_plugin_service.h"
+
+#include "base/bind.h"
+#include "base/message_loop.h"
+#include "webkit/plugins/npapi/plugin_group.h"
+#include "webkit/plugins/npapi/plugin_list.h"
+#include "webkit/plugins/webplugininfo.h"
+
+MockPluginService::MockPluginService(webkit::npapi::PluginList* plugin_list)
+ : PluginService(plugin_list) {
+ // Reset the callback so that tests don't trip the assertion set by the
+ // base class.
+ plugin_list->set_will_load_plugins_callback(base::Closure());
+}
+
+MockPluginService::~MockPluginService() {
+}
+
+void MockPluginService::GetPlugins(const GetPluginsCallback& cb) {
+ std::vector<webkit::WebPluginInfo> plugins;
+ plugin_list()->GetPlugins(&plugins);
+ MessageLoop::current()->PostTask(FROM_HERE, base::Bind(cb, plugins));
+}
+
+void MockPluginService::GetPluginGroups(const GetPluginGroupsCallback& cb) {
+ std::vector<webkit::npapi::PluginGroup> groups;
+ plugin_list()->GetPluginGroups(true, &groups);
+ MessageLoop::current()->PostTask(FROM_HERE, base::Bind(cb, groups));
+}
« content/test/mock_plugin_service.h ('K') | « content/test/mock_plugin_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698