Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: content/renderer/pepper/mock_renderer_ppapi_host.h

Issue 11419131: Refactor FileIO to the new design (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_PEPPER_MOCK_RENDERER_PPAPI_HOST_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_MOCK_RENDERER_PPAPI_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_MOCK_RENDERER_PPAPI_HOST_H_ 6 #define CONTENT_RENDERER_PEPPER_MOCK_RENDERER_PPAPI_HOST_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "content/public/renderer/renderer_ppapi_host.h" 9 #include "content/public/renderer/renderer_ppapi_host.h"
10 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" 10 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
11 #include "ppapi/host/ppapi_host.h" 11 #include "ppapi/host/ppapi_host.h"
12 #include "ppapi/proxy/resource_message_test_sink.h" 12 #include "ppapi/proxy/resource_message_test_sink.h"
13 13
14 namespace webkit { 14 namespace webkit {
15 namespace ppapi { 15 namespace ppapi {
16 class PluginDelegate;
16 class PluginInstance; 17 class PluginInstance;
17 class PluginModule; 18 class PluginModule;
18 } 19 }
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 23
23 // A mock RendererPpapiHost for testing resource hosts. Messages sent by 24 // A mock RendererPpapiHost for testing resource hosts. Messages sent by
24 // resources through this will get added to the test sink. 25 // resources through this will get added to the test sink.
25 class MockRendererPpapiHost : public RendererPpapiHost { 26 class MockRendererPpapiHost : public RendererPpapiHost {
26 public: 27 public:
27 // This function takes the RenderView and instance that the mock resource 28 // This function takes the RenderView and instance that the mock resource
28 // host will be associated with. 29 // host will be associated with.
29 MockRendererPpapiHost(RenderView* render_view, 30 MockRendererPpapiHost(RenderView* render_view,
30 PP_Instance instance); 31 PP_Instance instance);
31 virtual ~MockRendererPpapiHost(); 32 virtual ~MockRendererPpapiHost();
32 33
33 ppapi::proxy::ResourceMessageTestSink& sink() { return sink_; } 34 ppapi::proxy::ResourceMessageTestSink& sink() { return sink_; }
34 PP_Instance pp_instance() const { return pp_instance_; } 35 PP_Instance pp_instance() const { return pp_instance_; }
35 36
36 // Sets whether there is currently a user gesture. Defaults to false. 37 // Sets whether there is currently a user gesture. Defaults to false.
37 void set_has_user_gesture(bool gesture) { has_user_gesture_ = gesture; } 38 void set_has_user_gesture(bool gesture) { has_user_gesture_ = gesture; }
38 39
39 // RendererPpapiHost. 40 // RendererPpapiHost.
40 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; 41 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE;
41 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; 42 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE;
42 virtual webkit::ppapi::PluginInstance* GetPluginInstance( 43 virtual webkit::ppapi::PluginInstance* GetPluginInstance(
43 PP_Instance instance) const OVERRIDE; 44 PP_Instance instance) const OVERRIDE;
45 virtual webkit::ppapi::PluginDelegate* GetDelegateForInstance(
46 PP_Instance instance) const OVERRIDE;
44 virtual RenderView* GetRenderViewForInstance( 47 virtual RenderView* GetRenderViewForInstance(
45 PP_Instance instance) const OVERRIDE; 48 PP_Instance instance) const OVERRIDE;
46 virtual WebKit::WebPluginContainer* GetContainerForInstance( 49 virtual WebKit::WebPluginContainer* GetContainerForInstance(
47 PP_Instance instance) const OVERRIDE; 50 PP_Instance instance) const OVERRIDE;
48 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE; 51 virtual bool HasUserGesture(PP_Instance instance) const OVERRIDE;
49 virtual int GetRoutingIDForWidget(PP_Instance instance) const OVERRIDE; 52 virtual int GetRoutingIDForWidget(PP_Instance instance) const OVERRIDE;
50 virtual gfx::Point PluginPointToRenderView( 53 virtual gfx::Point PluginPointToRenderView(
51 PP_Instance instance, 54 PP_Instance instance,
52 const gfx::Point& pt) const OVERRIDE; 55 const gfx::Point& pt) const OVERRIDE;
53 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( 56 virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
54 base::PlatformFile handle, 57 base::PlatformFile handle,
55 bool should_close_source) OVERRIDE; 58 bool should_close_source) OVERRIDE;
56 59
57 private: 60 private:
58 ppapi::proxy::ResourceMessageTestSink sink_; 61 ppapi::proxy::ResourceMessageTestSink sink_;
59 ppapi::host::PpapiHost ppapi_host_; 62 ppapi::host::PpapiHost ppapi_host_;
60 63
61 RenderView* render_view_; 64 RenderView* render_view_;
62 PP_Instance pp_instance_; 65 PP_Instance pp_instance_;
63 66
64 bool has_user_gesture_; 67 bool has_user_gesture_;
65 68
66 DISALLOW_COPY_AND_ASSIGN(MockRendererPpapiHost); 69 DISALLOW_COPY_AND_ASSIGN(MockRendererPpapiHost);
67 }; 70 };
68 71
69 } // namespace content 72 } // namespace content
70 73
71 #endif // CONTENT_RENDERER_PEPPER_MOCK_RENDERER_PPAPI_HOST_H_ 74 #endif // CONTENT_RENDERER_PEPPER_MOCK_RENDERER_PPAPI_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698