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_MOCK_PLUGIN_SERVICE_H_ | |
6 #define CONTENT_TEST_MOCK_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 conjection 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 MockPluginService : public PluginService { | |
Bernhard Bauer
2011/11/07 22:37:50
Could we call this TestingPluginService? If I read
Robert Sesek
2011/11/07 23:05:49
Sure. The other "mocks" are also not true GMock mo
| |
27 public: | |
28 MockPluginService(webkit::npapi::PluginList* plugin_list); | |
Bernhard Bauer
2011/11/07 22:37:50
Could you demand a MockPluginList here, or are the
Robert Sesek
2011/11/07 23:05:49
I thought about it, but there's no reason to be th
| |
29 virtual ~MockPluginService(); | |
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_MOCK_PLUGIN_SERVICE_H_ | |
OLD | NEW |