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(
27 const base::string16
& text
,
28 const std::vector
<WebKit::WebCompositionUnderline
>& underlines
,
31 virtual void SimulateImeConfirmComposition(const base::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(
39 const base::FilePath
& file_path
);
40 virtual PlatformImage2D
* CreateImage2D(int width
, int height
);
41 virtual PlatformGraphics2D
* GetGraphics2D(PluginInstance
* instance
,
42 PP_Resource graphics_2d
);
43 virtual PlatformContext3D
* CreateContext3D();
44 virtual void ReparentContext(PlatformContext3D
*);
45 virtual PlatformVideoDecoder
* CreateVideoDecoder(
46 media::VideoDecodeAccelerator::Client
* client
,
47 int32 command_buffer_route_id
);
48 virtual PlatformVideoCapture
* CreateVideoCapture(
49 const std::string
& device_id
,
50 PlatformVideoCaptureEventHandler
* handler
);
51 virtual uint32_t GetAudioHardwareOutputSampleRate();
52 virtual uint32_t GetAudioHardwareOutputBufferSize();
53 virtual PlatformAudioOutput
* CreateAudioOutput(
55 uint32_t sample_count
,
56 PlatformAudioOutputClient
* client
);
57 virtual PlatformAudioInput
* CreateAudioInput(
58 const std::string
& device_id
,
60 uint32_t sample_count
,
61 PlatformAudioInputClient
* client
);
62 virtual Broker
* ConnectToBroker(PPB_Broker_Impl
* client
);
63 virtual void NumberOfFindResultsChanged(int identifier
,
66 virtual void SelectedFindResultChanged(int identifier
, int index
);
67 virtual bool AsyncOpenFile(const base::FilePath
& path
,
69 const AsyncOpenFileCallback
& callback
);
70 virtual bool AsyncOpenFileSystemURL(
73 const AsyncOpenFileSystemURLCallback
& callback
);
74 virtual bool OpenFileSystem(
75 const GURL
& origin_url
,
76 fileapi::FileSystemType type
,
78 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
79 virtual bool MakeDirectory(
82 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
83 virtual bool Query(const GURL
& path
,
84 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
85 virtual bool Touch(const GURL
& path
,
86 const base::Time
& last_access_time
,
87 const base::Time
& last_modified_time
,
88 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
89 virtual bool SetLength(const GURL
& path
,
91 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
92 virtual bool Delete(const GURL
& path
,
93 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
94 virtual bool Rename(const GURL
& file_path
,
95 const GURL
& new_file_path
,
96 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
97 virtual bool ReadDirectory(
98 const GURL
& directory_path
,
99 fileapi::FileSystemCallbackDispatcher
* dispatcher
);
100 virtual void QueryAvailableSpace(const GURL
& origin
,
101 quota::StorageType type
,
102 const AvailableSpaceCallback
& callback
);
103 virtual void WillUpdateFile(const GURL
& file_path
);
104 virtual void DidUpdateFile(const GURL
& file_path
, int64_t delta
);
105 virtual void SyncGetFileSystemPlatformPath(const GURL
& url
,
106 base::FilePath
* platform_path
);
107 virtual scoped_refptr
<base::MessageLoopProxy
>
108 GetFileThreadMessageLoopProxy();
109 virtual uint32
TCPSocketCreate();
110 virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl
* socket
,
112 const std::string
& host
,
114 virtual void TCPSocketConnectWithNetAddress(
115 PPB_TCPSocket_Private_Impl
* socket
,
117 const PP_NetAddress_Private
& addr
);
118 virtual void TCPSocketSSLHandshake(
120 const std::string
& server_name
,
121 uint16_t server_port
,
122 const std::vector
<std::vector
<char> >& trusted_certs
,
123 const std::vector
<std::vector
<char> >& untrusted_certs
);
124 virtual void TCPSocketRead(uint32 socket_id
, int32_t bytes_to_read
);
125 virtual void TCPSocketWrite(uint32 socket_id
, const std::string
& buffer
);
126 virtual void TCPSocketDisconnect(uint32 socket_id
);
127 virtual void TCPSocketSetBoolOption(uint32 socket_id
,
128 PP_TCPSocketOption_Private name
,
130 virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl
* socket
,
132 virtual void TCPServerSocketListen(PP_Resource socket_resource
,
133 const PP_NetAddress_Private
& addr
,
135 virtual void TCPServerSocketAccept(uint32 server_socket_id
);
136 virtual void TCPServerSocketStopListening(PP_Resource socket_resource
,
138 // Add/remove a network list observer.
139 virtual bool AddNetworkListObserver(
140 webkit_glue::NetworkListObserver
* observer
) OVERRIDE
;
141 virtual void RemoveNetworkListObserver(
142 webkit_glue::NetworkListObserver
* observer
) OVERRIDE
;
143 virtual bool X509CertificateParseDER(
144 const std::vector
<char>& der
,
145 ::ppapi::PPB_X509Certificate_Fields
* fields
);
146 virtual FullscreenContainer
* CreateFullscreenContainer(
147 PluginInstance
* instance
);
148 virtual gfx::Size
GetScreenSize();
149 virtual std::string
GetDefaultEncoding();
150 virtual void ZoomLimitsChanged(double minimum_factor
,
151 double maximum_factor
);
152 virtual void DidStartLoading();
153 virtual void DidStopLoading();
154 virtual void SetContentRestriction(int restrictions
);
155 virtual void SaveURLAs(const GURL
& url
);
156 virtual base::SharedMemory
* CreateAnonymousSharedMemory(size_t size
);
157 virtual ::ppapi::Preferences
GetPreferences();
158 virtual bool LockMouse(PluginInstance
* instance
);
159 virtual void UnlockMouse(PluginInstance
* instance
);
160 virtual bool IsMouseLocked(PluginInstance
* instance
);
161 virtual void DidChangeCursor(PluginInstance
* instance
,
162 const WebKit::WebCursorInfo
& cursor
);
163 virtual void DidReceiveMouseEvent(PluginInstance
* instance
);
164 virtual void SampleGamepads(WebKit::WebGamepads
* data
) OVERRIDE
;
165 virtual bool IsInFullscreenMode();
166 virtual bool IsPageVisible() const;
167 virtual int EnumerateDevices(PP_DeviceType_Dev type
,
168 const EnumerateDevicesCallback
& callback
);
169 virtual void StopEnumerateDevices(int request_id
);
170 virtual IPC::PlatformFileForTransit
ShareHandleWithRemote(
171 base::PlatformFile handle
,
172 base::ProcessId target_process_id
,
173 bool should_close_source
) const;
177 } // namespace webkit
179 #endif // WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_