OLD | NEW |
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_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 virtual ~MockRenderProcessHost(); | 26 virtual ~MockRenderProcessHost(); |
27 | 27 |
28 // Provides access to all IPC messages that would have been sent to the | 28 // Provides access to all IPC messages that would have been sent to the |
29 // renderer via this RenderProcessHost. | 29 // renderer via this RenderProcessHost. |
30 IPC::TestSink& sink() { return sink_; } | 30 IPC::TestSink& sink() { return sink_; } |
31 | 31 |
32 // Provides test access to how many times a bad message has been received. | 32 // Provides test access to how many times a bad message has been received. |
33 int bad_msg_count() const { return bad_msg_count_; } | 33 int bad_msg_count() const { return bad_msg_count_; } |
34 | 34 |
35 // RenderProcessHost implementation (public portion). | 35 // RenderProcessHost implementation (public portion). |
36 virtual void EnableSendQueue() OVERRIDE; | 36 virtual void EnableSendQueue() override; |
37 virtual bool Init() OVERRIDE; | 37 virtual bool Init() override; |
38 virtual int GetNextRoutingID() OVERRIDE; | 38 virtual int GetNextRoutingID() override; |
39 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE; | 39 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) override; |
40 virtual void RemoveRoute(int32 routing_id) OVERRIDE; | 40 virtual void RemoveRoute(int32 routing_id) override; |
41 virtual void AddObserver(RenderProcessHostObserver* observer) OVERRIDE; | 41 virtual void AddObserver(RenderProcessHostObserver* observer) override; |
42 virtual void RemoveObserver(RenderProcessHostObserver* observer) OVERRIDE; | 42 virtual void RemoveObserver(RenderProcessHostObserver* observer) override; |
43 virtual void ReceivedBadMessage() OVERRIDE; | 43 virtual void ReceivedBadMessage() override; |
44 virtual void WidgetRestored() OVERRIDE; | 44 virtual void WidgetRestored() override; |
45 virtual void WidgetHidden() OVERRIDE; | 45 virtual void WidgetHidden() override; |
46 virtual int VisibleWidgetCount() const OVERRIDE; | 46 virtual int VisibleWidgetCount() const override; |
47 virtual bool IsIsolatedGuest() const OVERRIDE; | 47 virtual bool IsIsolatedGuest() const override; |
48 virtual StoragePartition* GetStoragePartition() const OVERRIDE; | 48 virtual StoragePartition* GetStoragePartition() const override; |
49 virtual void AddWord(const base::string16& word); | 49 virtual void AddWord(const base::string16& word); |
50 virtual bool FastShutdownIfPossible() OVERRIDE; | 50 virtual bool FastShutdownIfPossible() override; |
51 virtual bool FastShutdownStarted() const OVERRIDE; | 51 virtual bool FastShutdownStarted() const override; |
52 virtual void DumpHandles() OVERRIDE; | 52 virtual void DumpHandles() override; |
53 virtual base::ProcessHandle GetHandle() const OVERRIDE; | 53 virtual base::ProcessHandle GetHandle() const override; |
54 virtual int GetID() const OVERRIDE; | 54 virtual int GetID() const override; |
55 virtual bool HasConnection() const OVERRIDE; | 55 virtual bool HasConnection() const override; |
56 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; | 56 virtual void SetIgnoreInputEvents(bool ignore_input_events) override; |
57 virtual bool IgnoreInputEvents() const OVERRIDE; | 57 virtual bool IgnoreInputEvents() const override; |
58 virtual void Cleanup() OVERRIDE; | 58 virtual void Cleanup() override; |
59 virtual void AddPendingView() OVERRIDE; | 59 virtual void AddPendingView() override; |
60 virtual void RemovePendingView() OVERRIDE; | 60 virtual void RemovePendingView() override; |
61 virtual void SetSuddenTerminationAllowed(bool allowed) OVERRIDE; | 61 virtual void SetSuddenTerminationAllowed(bool allowed) override; |
62 virtual bool SuddenTerminationAllowed() const OVERRIDE; | 62 virtual bool SuddenTerminationAllowed() const override; |
63 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 63 virtual BrowserContext* GetBrowserContext() const override; |
64 virtual bool InSameStoragePartition( | 64 virtual bool InSameStoragePartition( |
65 StoragePartition* partition) const OVERRIDE; | 65 StoragePartition* partition) const override; |
66 virtual IPC::ChannelProxy* GetChannel() OVERRIDE; | 66 virtual IPC::ChannelProxy* GetChannel() override; |
67 virtual void AddFilter(BrowserMessageFilter* filter) OVERRIDE; | 67 virtual void AddFilter(BrowserMessageFilter* filter) override; |
68 virtual bool FastShutdownForPageCount(size_t count) OVERRIDE; | 68 virtual bool FastShutdownForPageCount(size_t count) override; |
69 virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE; | 69 virtual base::TimeDelta GetChildProcessIdleTime() const override; |
70 virtual void ResumeRequestsForView(int route_id) OVERRIDE; | 70 virtual void ResumeRequestsForView(int route_id) override; |
71 virtual void FilterURL(bool empty_allowed, GURL* url) OVERRIDE; | 71 virtual void FilterURL(bool empty_allowed, GURL* url) override; |
72 #if defined(ENABLE_WEBRTC) | 72 #if defined(ENABLE_WEBRTC) |
73 virtual void EnableAecDump(const base::FilePath& file) OVERRIDE; | 73 virtual void EnableAecDump(const base::FilePath& file) override; |
74 virtual void DisableAecDump() OVERRIDE; | 74 virtual void DisableAecDump() override; |
75 virtual void SetWebRtcLogMessageCallback( | 75 virtual void SetWebRtcLogMessageCallback( |
76 base::Callback<void(const std::string&)> callback) OVERRIDE; | 76 base::Callback<void(const std::string&)> callback) override; |
77 virtual WebRtcStopRtpDumpCallback StartRtpDump( | 77 virtual WebRtcStopRtpDumpCallback StartRtpDump( |
78 bool incoming, | 78 bool incoming, |
79 bool outgoing, | 79 bool outgoing, |
80 const WebRtcRtpPacketCallback& packet_callback) OVERRIDE; | 80 const WebRtcRtpPacketCallback& packet_callback) override; |
81 #endif | 81 #endif |
82 virtual void ResumeDeferredNavigation(const GlobalRequestID& request_id) | 82 virtual void ResumeDeferredNavigation(const GlobalRequestID& request_id) |
83 OVERRIDE; | 83 override; |
84 virtual void NotifyTimezoneChange() OVERRIDE; | 84 virtual void NotifyTimezoneChange() override; |
85 virtual ServiceRegistry* GetServiceRegistry() OVERRIDE; | 85 virtual ServiceRegistry* GetServiceRegistry() override; |
86 | 86 |
87 // IPC::Sender via RenderProcessHost. | 87 // IPC::Sender via RenderProcessHost. |
88 virtual bool Send(IPC::Message* msg) OVERRIDE; | 88 virtual bool Send(IPC::Message* msg) override; |
89 | 89 |
90 // IPC::Listener via RenderProcessHost. | 90 // IPC::Listener via RenderProcessHost. |
91 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 91 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
92 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 92 virtual void OnChannelConnected(int32 peer_pid) override; |
93 | 93 |
94 // Attaches the factory object so we can remove this object in its destructor | 94 // Attaches the factory object so we can remove this object in its destructor |
95 // and prevent MockRenderProcessHostFacotry from deleting it. | 95 // and prevent MockRenderProcessHostFacotry from deleting it. |
96 void SetFactory(const MockRenderProcessHostFactory* factory) { | 96 void SetFactory(const MockRenderProcessHostFactory* factory) { |
97 factory_ = factory; | 97 factory_ = factory; |
98 } | 98 } |
99 | 99 |
100 int GetActiveViewCount(); | 100 int GetActiveViewCount(); |
101 | 101 |
102 void set_is_isolated_guest(bool is_isolated_guest) { | 102 void set_is_isolated_guest(bool is_isolated_guest) { |
(...skipping 24 matching lines...) Expand all Loading... |
127 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 127 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
128 }; | 128 }; |
129 | 129 |
130 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 130 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
131 public: | 131 public: |
132 MockRenderProcessHostFactory(); | 132 MockRenderProcessHostFactory(); |
133 virtual ~MockRenderProcessHostFactory(); | 133 virtual ~MockRenderProcessHostFactory(); |
134 | 134 |
135 virtual RenderProcessHost* CreateRenderProcessHost( | 135 virtual RenderProcessHost* CreateRenderProcessHost( |
136 BrowserContext* browser_context, | 136 BrowserContext* browser_context, |
137 SiteInstance* site_instance) const OVERRIDE; | 137 SiteInstance* site_instance) const override; |
138 | 138 |
139 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list | 139 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list |
140 // without deleting it. When a test deletes a MockRenderProcessHost, we need | 140 // without deleting it. When a test deletes a MockRenderProcessHost, we need |
141 // to remove it from |processes_| to prevent it from being deleted twice. | 141 // to remove it from |processes_| to prevent it from being deleted twice. |
142 void Remove(MockRenderProcessHost* host) const; | 142 void Remove(MockRenderProcessHost* host) const; |
143 | 143 |
144 private: | 144 private: |
145 // A list of MockRenderProcessHosts created by this object. This list is used | 145 // A list of MockRenderProcessHosts created by this object. This list is used |
146 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 146 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
147 // the destructor and prevent them from being leaked. | 147 // the destructor and prevent them from being leaked. |
148 mutable ScopedVector<MockRenderProcessHost> processes_; | 148 mutable ScopedVector<MockRenderProcessHost> processes_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 150 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace content | 153 } // namespace content |
154 | 154 |
155 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 155 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |