OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/proxy/ppapi_proxy_test.h" | 5 #include "ppapi/proxy/ppapi_proxy_test.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "ipc/ipc_sync_channel.h" | 9 #include "ipc/ipc_sync_channel.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 PluginProxyTestHarness::~PluginProxyTestHarness() { | 141 PluginProxyTestHarness::~PluginProxyTestHarness() { |
142 } | 142 } |
143 | 143 |
144 Dispatcher* PluginProxyTestHarness::GetDispatcher() { | 144 Dispatcher* PluginProxyTestHarness::GetDispatcher() { |
145 return plugin_dispatcher_.get(); | 145 return plugin_dispatcher_.get(); |
146 } | 146 } |
147 | 147 |
148 void PluginProxyTestHarness::SetUpHarness() { | 148 void PluginProxyTestHarness::SetUpHarness() { |
149 // These must be first since the dispatcher set-up uses them. | 149 // These must be first since the dispatcher set-up uses them. |
150 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); | 150 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); |
151 PluginVarTracker::SetInstanceForTest(&var_tracker_); | 151 resource_tracker_.set_var_tracker_test_override(&var_tracker_); |
152 | 152 |
153 plugin_dispatcher_.reset(new PluginDispatcher( | 153 plugin_dispatcher_.reset(new PluginDispatcher( |
154 base::Process::Current().handle(), | 154 base::Process::Current().handle(), |
155 &MockGetInterface)); | 155 &MockGetInterface)); |
156 plugin_dispatcher_->InitWithTestSink(&sink()); | 156 plugin_dispatcher_->InitWithTestSink(&sink()); |
157 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 157 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
158 } | 158 } |
159 | 159 |
160 void PluginProxyTestHarness::SetUpHarnessWithChannel( | 160 void PluginProxyTestHarness::SetUpHarnessWithChannel( |
161 const IPC::ChannelHandle& channel_handle, | 161 const IPC::ChannelHandle& channel_handle, |
162 base::MessageLoopProxy* ipc_message_loop, | 162 base::MessageLoopProxy* ipc_message_loop, |
163 base::WaitableEvent* shutdown_event, | 163 base::WaitableEvent* shutdown_event, |
164 bool is_client) { | 164 bool is_client) { |
165 // These must be first since the dispatcher set-up uses them. | 165 // These must be first since the dispatcher set-up uses them. |
166 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); | 166 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); |
167 PluginVarTracker::SetInstanceForTest(&var_tracker_); | 167 resource_tracker_.set_var_tracker_test_override(&var_tracker_); |
168 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); | 168 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); |
169 | 169 |
170 plugin_dispatcher_.reset(new PluginDispatcher( | 170 plugin_dispatcher_.reset(new PluginDispatcher( |
171 base::Process::Current().handle(), | 171 base::Process::Current().handle(), |
172 &MockGetInterface)); | 172 &MockGetInterface)); |
173 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, | 173 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, |
174 channel_handle, | 174 channel_handle, |
175 is_client); | 175 is_client); |
176 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 176 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
177 } | 177 } |
178 | 178 |
179 void PluginProxyTestHarness::TearDownHarness() { | 179 void PluginProxyTestHarness::TearDownHarness() { |
180 plugin_dispatcher_->DidDestroyInstance(pp_instance()); | 180 plugin_dispatcher_->DidDestroyInstance(pp_instance()); |
181 plugin_dispatcher_.reset(); | 181 plugin_dispatcher_.reset(); |
182 | 182 |
183 PluginVarTracker::SetInstanceForTest(NULL); | |
184 PluginResourceTracker::SetInstanceForTest(NULL); | 183 PluginResourceTracker::SetInstanceForTest(NULL); |
185 } | 184 } |
186 | 185 |
187 base::MessageLoopProxy* | 186 base::MessageLoopProxy* |
188 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { | 187 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { |
189 return ipc_message_loop_; | 188 return ipc_message_loop_; |
190 } | 189 } |
191 | 190 |
192 base::WaitableEvent* | 191 base::WaitableEvent* |
193 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { | 192 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 remote_harness_torn_down.Wait(); | 366 remote_harness_torn_down.Wait(); |
368 | 367 |
369 local_harness_->TearDownHarness(); | 368 local_harness_->TearDownHarness(); |
370 | 369 |
371 io_thread_.Stop(); | 370 io_thread_.Stop(); |
372 } | 371 } |
373 | 372 |
374 | 373 |
375 } // namespace proxy | 374 } // namespace proxy |
376 } // namespace pp | 375 } // namespace pp |
OLD | NEW |