| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 base::Callback<void(const std::string&)> callback) override; | 87 base::Callback<void(const std::string&)> callback) override; |
| 88 void ClearWebRtcLogMessageCallback() override; | 88 void ClearWebRtcLogMessageCallback() override; |
| 89 WebRtcStopRtpDumpCallback StartRtpDump( | 89 WebRtcStopRtpDumpCallback StartRtpDump( |
| 90 bool incoming, | 90 bool incoming, |
| 91 bool outgoing, | 91 bool outgoing, |
| 92 const WebRtcRtpPacketCallback& packet_callback) override; | 92 const WebRtcRtpPacketCallback& packet_callback) override; |
| 93 #endif | 93 #endif |
| 94 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; | 94 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; |
| 95 void NotifyTimezoneChange(const std::string& zone_id) override; | 95 void NotifyTimezoneChange(const std::string& zone_id) override; |
| 96 ServiceRegistry* GetServiceRegistry() override; | 96 ServiceRegistry* GetServiceRegistry() override; |
| 97 scoped_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() | 97 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() |
| 98 override; | 98 override; |
| 99 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; | 99 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; |
| 100 bool SubscribeUniformEnabled() const override; | 100 bool SubscribeUniformEnabled() const override; |
| 101 void OnAddSubscription(unsigned int target) override; | 101 void OnAddSubscription(unsigned int target) override; |
| 102 void OnRemoveSubscription(unsigned int target) override; | 102 void OnRemoveSubscription(unsigned int target) override; |
| 103 void SendUpdateValueState( | 103 void SendUpdateValueState( |
| 104 unsigned int target, const gpu::ValueState& state) override; | 104 unsigned int target, const gpu::ValueState& state) override; |
| 105 #if defined(ENABLE_BROWSER_CDMS) | 105 #if defined(ENABLE_BROWSER_CDMS) |
| 106 scoped_refptr<media::MediaKeys> GetCdm(int render_frame_id, | 106 scoped_refptr<media::MediaKeys> GetCdm(int render_frame_id, |
| 107 int cdm_id) const override; | 107 int cdm_id) const override; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 void set_is_for_guests_only(bool is_for_guests_only) { | 126 void set_is_for_guests_only(bool is_for_guests_only) { |
| 127 is_for_guests_only_ = is_for_guests_only; | 127 is_for_guests_only_ = is_for_guests_only; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void set_is_process_backgrounded(bool is_process_backgrounded) { | 130 void set_is_process_backgrounded(bool is_process_backgrounded) { |
| 131 is_process_backgrounded_ = is_process_backgrounded; | 131 is_process_backgrounded_ = is_process_backgrounded; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SetProcessHandle(scoped_ptr<base::ProcessHandle> new_handle) { | 134 void SetProcessHandle(std::unique_ptr<base::ProcessHandle> new_handle) { |
| 135 process_handle = std::move(new_handle); | 135 process_handle = std::move(new_handle); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void GetAudioOutputControllers( | 138 void GetAudioOutputControllers( |
| 139 const GetAudioOutputControllersCallback& callback) const override {} | 139 const GetAudioOutputControllersCallback& callback) const override {} |
| 140 | 140 |
| 141 int worker_ref_count() const { return worker_ref_count_; } | 141 int worker_ref_count() const { return worker_ref_count_; } |
| 142 | 142 |
| 143 void SetServiceRegistry(scoped_ptr<ServiceRegistry> service_registry) { | 143 void SetServiceRegistry(std::unique_ptr<ServiceRegistry> service_registry) { |
| 144 service_registry_ = std::move(service_registry); | 144 service_registry_ = std::move(service_registry); |
| 145 } | 145 } |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 // Stores IPC messages that would have been sent to the renderer. | 148 // Stores IPC messages that would have been sent to the renderer. |
| 149 IPC::TestSink sink_; | 149 IPC::TestSink sink_; |
| 150 int bad_msg_count_; | 150 int bad_msg_count_; |
| 151 const MockRenderProcessHostFactory* factory_; | 151 const MockRenderProcessHostFactory* factory_; |
| 152 int id_; | 152 int id_; |
| 153 bool has_connection_; | 153 bool has_connection_; |
| 154 BrowserContext* browser_context_; | 154 BrowserContext* browser_context_; |
| 155 base::ObserverList<RenderProcessHostObserver> observers_; | 155 base::ObserverList<RenderProcessHostObserver> observers_; |
| 156 | 156 |
| 157 IDMap<RenderWidgetHost> render_widget_hosts_; | 157 IDMap<RenderWidgetHost> render_widget_hosts_; |
| 158 int prev_routing_id_; | 158 int prev_routing_id_; |
| 159 IDMap<IPC::Listener> listeners_; | 159 IDMap<IPC::Listener> listeners_; |
| 160 bool fast_shutdown_started_; | 160 bool fast_shutdown_started_; |
| 161 bool deletion_callback_called_; | 161 bool deletion_callback_called_; |
| 162 bool is_for_guests_only_; | 162 bool is_for_guests_only_; |
| 163 bool is_process_backgrounded_; | 163 bool is_process_backgrounded_; |
| 164 scoped_ptr<base::ProcessHandle> process_handle; | 164 std::unique_ptr<base::ProcessHandle> process_handle; |
| 165 int worker_ref_count_; | 165 int worker_ref_count_; |
| 166 scoped_ptr<ServiceRegistry> service_registry_; | 166 std::unique_ptr<ServiceRegistry> service_registry_; |
| 167 | 167 |
| 168 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 168 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 171 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
| 172 public: | 172 public: |
| 173 MockRenderProcessHostFactory(); | 173 MockRenderProcessHostFactory(); |
| 174 ~MockRenderProcessHostFactory() override; | 174 ~MockRenderProcessHostFactory() override; |
| 175 | 175 |
| 176 RenderProcessHost* CreateRenderProcessHost( | 176 RenderProcessHost* CreateRenderProcessHost( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 187 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 187 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
| 188 // the destructor and prevent them from being leaked. | 188 // the destructor and prevent them from being leaked. |
| 189 mutable ScopedVector<MockRenderProcessHost> processes_; | 189 mutable ScopedVector<MockRenderProcessHost> processes_; |
| 190 | 190 |
| 191 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 191 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 } // namespace content | 194 } // namespace content |
| 195 | 195 |
| 196 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 196 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |