OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_TEST_TEST_PLUGIN_SERVICE_H_ |
| 6 #define CONTENT_TEST_TEST_PLUGIN_SERVICE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "content/browser/plugin_service.h" |
| 10 |
| 11 namespace webkit { |
| 12 namespace npapi { |
| 13 class PluginList; |
| 14 } |
| 15 } |
| 16 |
| 17 // This class can be used in tests to bypass the actual plugin loading logic. It |
| 18 // is meant to be used in conjuction with MockPluginList and will perform a |
| 19 // synchronous load of plugins on the thread on which the GetPlugin* methods |
| 20 // were called. Note that the callbacks will still be run off the message loop. |
| 21 // |
| 22 // If you're wondering how this works in conjunction with the PluginService |
| 23 // singleton, the answer is to refactor your component to use dependency |
| 24 // injection to take an instance of PluginService, store it as a member, and |
| 25 // pass in an instance of this during tests. |
| 26 class TestPluginService : public PluginService { |
| 27 public: |
| 28 TestPluginService(webkit::npapi::PluginList* plugin_list); |
| 29 virtual ~TestPluginService(); |
| 30 |
| 31 // PluginService: |
| 32 virtual void GetPlugins(const GetPluginsCallback& cb) OVERRIDE; |
| 33 virtual void GetPluginGroups(const GetPluginGroupsCallback& cb) OVERRIDE; |
| 34 }; |
| 35 |
| 36 #endif // CONTENT_TEST_TEST_PLUGIN_SERVICE_H_ |
OLD | NEW |