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

Unified Diff: content/test/test_plugin_service.h

Issue 8493019: Refactor PluginService to take PluginList as a dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Init() 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
Index: content/test/test_plugin_service.h
diff --git a/content/test/test_plugin_service.h b/content/test/test_plugin_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..49845520171c5734097482912b1ee29501c27031
--- /dev/null
+++ b/content/test/test_plugin_service.h
@@ -0,0 +1,36 @@
+// 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.
+
+#ifndef CONTENT_TEST_TEST_PLUGIN_SERVICE_H_
+#define CONTENT_TEST_TEST_PLUGIN_SERVICE_H_
+#pragma once
+
+#include "content/browser/plugin_service.h"
+
+namespace webkit {
+namespace npapi {
+class PluginList;
+}
+}
+
+// This class can be used in tests to bypass the actual plugin loading logic. It
+// is meant to be used in conjuction with MockPluginList and will perform a
+// synchronous load of plugins on the thread on which the GetPlugin* methods
+// were called. Note that the callbacks will still be run off the message loop.
+//
+// If you're wondering how this works in conjunction with the PluginService
+// singleton, the answer is to refactor your component to use dependency
+// injection to take an instance of PluginService, store it as a member, and
+// pass in an instance of this during tests.
+class TestPluginService : public PluginService {
+ public:
+ TestPluginService(webkit::npapi::PluginList* plugin_list);
+ virtual ~TestPluginService();
+
+ // PluginService:
+ virtual void GetPlugins(const GetPluginsCallback& cb) OVERRIDE;
+ virtual void GetPluginGroups(const GetPluginGroupsCallback& cb) OVERRIDE;
+};
+
+#endif // CONTENT_TEST_TEST_PLUGIN_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698