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_ |