1 // Copyright (c) 2012 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.
5 #ifndef WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_
6 #define WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_
8 #include "webkit/plugins/ppapi/plugin_delegate.h"
10 struct PP_NetAddress_Private
;
11 namespace ppapi
{ class PPB_X509Certificate_Fields
; }
16 class MockPluginDelegate
: public PluginDelegate
{
19 virtual ~MockPluginDelegate();
21 virtual void PluginFocusChanged(PluginInstance
* instance
, bool focused
);
22 virtual void PluginTextInputTypeChanged(PluginInstance
* instance
);
23 virtual void PluginCaretPositionChanged(PluginInstance
* instance
);
24 virtual void PluginRequestedCancelComposition(PluginInstance
* instance
);
25 virtual void PluginSelectionChanged(PluginInstance
* instance
);
26 virtual void SimulateImeSetComposition(
28 const std::vector
<WebKit::WebCompositionUnderline
>& underlines
,
31 virtual void SimulateImeConfirmComposition(const string16
& text
);
32 virtual void PluginCrashed(PluginInstance
* instance
);
33 virtual void InstanceCreated(PluginInstance
* instance
);
34 virtual void InstanceDeleted(PluginInstance
* instance
);
35 virtual scoped_ptr
< ::ppapi::thunk::ResourceCreationAPI
>
36 CreateResourceCreationAPI(PluginInstance
* instance
);
37 virtual SkBitmap
* GetSadPluginBitmap();
38 virtual WebKit::WebPlugin
* CreatePluginReplacement(const FilePath
& file_path
);
39 virtual PlatformImage2D
* CreateImage2D(int width
, int height
);
40 virtual PlatformGraphics2D
* GetGraphics2D(PluginInstance
* instance
,
41 PP_Resource graphics_2d
);
42 virtual PlatformContext3D
* CreateContext3D();
43 virtual void ReparentContext(PlatformContext3D
*);
44 virtual PlatformVideoDecoder
* CreateVideoDecoder(
45 media::VideoDecodeAccelerator::Client
* client
,
46 int32 command_buffer_route_id
);
47 virtual PlatformVideoCapture
* CreateVideoCapture(
48 const std::string
& device_id
,
49 PlatformVideoCaptureEventHandler
* handler
);
50 virtual uint32_t GetAudioHardwareOutputSampleRate();
51 virtual uint32_t GetAudioHardwareOutputBufferSize();
52 virtual PlatformAudioOutput
* CreateAudioOutput(
54 uint32_t sample_count
,
55 PlatformAudioOutputClient
* client
);
56 virtual PlatformAudioInput
* CreateAudioInput(
57 const std::string
& device_id
,
59 uint32_t sample_count
,
60 PlatformAudioInputClient
* client
);
61 virtual Broker
* ConnectToBroker(PPB_Broker_Impl
* client
);
62 virtual void NumberOfFindResultsChanged(int identifier
,
65 virtual void SelectedFindResultChanged(int identifier
, int index
);
66 virtual bool AsyncOpenFile(const FilePath
& path
,
68 const AsyncOpenFileCallback
& callback
);
69 virtual bool AsyncOpenFileSystemURL(
72 const AsyncOpenFileSystemURLCallback
& callback
);
73 virtual bool OpenFileSystem(
74 const GURL
& origin_url
,
75 fileapi::FileSystemType type
,
77 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
78 virtual bool MakeDirectory(
81 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
82 virtual bool Query(const GURL
& path
,
83 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
84 virtual bool Touch(const GURL
& path
,
85 const base::Time
& last_access_time
,
86 const base::Time
& last_modified_time
,
87 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
88 virtual bool SetLength(const GURL
& path
,
90 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
91 virtual bool Delete(const GURL
& path
,
92 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
93 virtual bool Rename(const GURL
& file_path
,
94 const GURL
& new_file_path
,
95 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
96 virtual bool ReadDirectory(
97 const GURL
& directory_path
,
98 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
99 virtual void QueryAvailableSpace(const GURL
& origin
,
100 quota::StorageType type
,
101 const AvailableSpaceCallback
& callback
);
102 virtual void WillUpdateFile(const GURL
& file_path
);
103 virtual void DidUpdateFile(const GURL
& file_path
, int64_t delta
);
104 virtual void SyncGetFileSystemPlatformPath(const GURL
& url
,
105 FilePath
* platform_path
);
106 virtual scoped_refptr
<base::MessageLoopProxy
>
107 GetFileThreadMessageLoopProxy();
108 virtual uint32
TCPSocketCreate();
109 virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl
* socket
,
111 const std::string
& host
,
113 virtual void TCPSocketConnectWithNetAddress(
114 PPB_TCPSocket_Private_Impl
* socket
,
116 const PP_NetAddress_Private
& addr
);
117 virtual void TCPSocketSSLHandshake(
119 const std::string
& server_name
,
120 uint16_t server_port
,
121 const std::vector
<std::vector
<char> >& trusted_certs
,
122 const std::vector
<std::vector
<char> >& untrusted_certs
);
123 virtual void TCPSocketRead(uint32 socket_id
, int32_t bytes_to_read
);
124 virtual void TCPSocketWrite(uint32 socket_id
, const std::string
& buffer
);
125 virtual void TCPSocketDisconnect(uint32 socket_id
);
126 virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl
* socket
,
128 virtual void TCPServerSocketListen(PP_Resource socket_resource
,
129 const PP_NetAddress_Private
& addr
,
131 virtual void TCPServerSocketAccept(uint32 server_socket_id
);
132 virtual void TCPServerSocketStopListening(PP_Resource socket_resource
,
134 virtual void RegisterHostResolver(
135 ::ppapi::PPB_HostResolver_Shared
* host_resolver
,
136 uint32 host_resolver_id
);
137 virtual void HostResolverResolve(
138 uint32 host_resolver_id
,
139 const ::ppapi::HostPortPair
& host_port
,
140 const PP_HostResolver_Private_Hint
* hint
);
141 virtual void UnregisterHostResolver(uint32 host_resolver_id
);
142 // Add/remove a network list observer.
143 virtual bool AddNetworkListObserver(
144 webkit_glue::NetworkListObserver
* observer
) OVERRIDE
;
145 virtual void RemoveNetworkListObserver(
146 webkit_glue::NetworkListObserver
* observer
) OVERRIDE
;
147 virtual bool X509CertificateParseDER(
148 const std::vector
<char>& der
,
149 ::ppapi::PPB_X509Certificate_Fields
* fields
);
150 virtual FullscreenContainer
* CreateFullscreenContainer(
151 PluginInstance
* instance
);
152 virtual gfx::Size
GetScreenSize();
153 virtual std::string
GetDefaultEncoding();
154 virtual void ZoomLimitsChanged(double minimum_factor
,
155 double maximum_factor
);
156 virtual void DidStartLoading();
157 virtual void DidStopLoading();
158 virtual void SetContentRestriction(int restrictions
);
159 virtual void SaveURLAs(const GURL
& url
);
160 virtual base::SharedMemory
* CreateAnonymousSharedMemory(size_t size
);
161 virtual ::ppapi::Preferences
GetPreferences();
162 virtual bool LockMouse(PluginInstance
* instance
);
163 virtual void UnlockMouse(PluginInstance
* instance
);
164 virtual bool IsMouseLocked(PluginInstance
* instance
);
165 virtual void DidChangeCursor(PluginInstance
* instance
,
166 const WebKit::WebCursorInfo
& cursor
);
167 virtual void DidReceiveMouseEvent(PluginInstance
* instance
);
168 virtual void SampleGamepads(WebKit::WebGamepads
* data
) OVERRIDE
;
169 virtual bool IsInFullscreenMode();
170 virtual bool IsPageVisible() const;
171 virtual int EnumerateDevices(PP_DeviceType_Dev type
,
172 const EnumerateDevicesCallback
& callback
);
173 virtual void StopEnumerateDevices(int request_id
);
177 } // namespace webkit
179 #endif // WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_