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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
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 resource_tracker_.DidCreateInstance(pp_instance()); |
150 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); | 151 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); |
151 resource_tracker_.set_var_tracker_test_override(&var_tracker_); | 152 resource_tracker_.set_var_tracker_test_override(&var_tracker_); |
152 | 153 |
153 plugin_dispatcher_.reset(new PluginDispatcher( | 154 plugin_dispatcher_.reset(new PluginDispatcher( |
154 base::Process::Current().handle(), | 155 base::Process::Current().handle(), |
155 &MockGetInterface)); | 156 &MockGetInterface)); |
156 plugin_dispatcher_->InitWithTestSink(&sink()); | 157 plugin_dispatcher_->InitWithTestSink(&sink()); |
157 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 158 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
158 } | 159 } |
159 | 160 |
160 void PluginProxyTestHarness::SetUpHarnessWithChannel( | 161 void PluginProxyTestHarness::SetUpHarnessWithChannel( |
161 const IPC::ChannelHandle& channel_handle, | 162 const IPC::ChannelHandle& channel_handle, |
162 base::MessageLoopProxy* ipc_message_loop, | 163 base::MessageLoopProxy* ipc_message_loop, |
163 base::WaitableEvent* shutdown_event, | 164 base::WaitableEvent* shutdown_event, |
164 bool is_client) { | 165 bool is_client) { |
165 // These must be first since the dispatcher set-up uses them. | 166 // These must be first since the dispatcher set-up uses them. |
| 167 resource_tracker_.DidCreateInstance(pp_instance()); |
166 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); | 168 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); |
167 resource_tracker_.set_var_tracker_test_override(&var_tracker_); | 169 resource_tracker_.set_var_tracker_test_override(&var_tracker_); |
168 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); | 170 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); |
169 | 171 |
170 plugin_dispatcher_.reset(new PluginDispatcher( | 172 plugin_dispatcher_.reset(new PluginDispatcher( |
171 base::Process::Current().handle(), | 173 base::Process::Current().handle(), |
172 &MockGetInterface)); | 174 &MockGetInterface)); |
173 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, | 175 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, |
174 channel_handle, | 176 channel_handle, |
175 is_client); | 177 is_client); |
176 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 178 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
177 } | 179 } |
178 | 180 |
179 void PluginProxyTestHarness::TearDownHarness() { | 181 void PluginProxyTestHarness::TearDownHarness() { |
180 plugin_dispatcher_->DidDestroyInstance(pp_instance()); | 182 plugin_dispatcher_->DidDestroyInstance(pp_instance()); |
181 plugin_dispatcher_.reset(); | 183 plugin_dispatcher_.reset(); |
182 | 184 |
| 185 resource_tracker_.DidDeleteInstance(pp_instance()); |
183 PluginResourceTracker::SetInstanceForTest(NULL); | 186 PluginResourceTracker::SetInstanceForTest(NULL); |
184 } | 187 } |
185 | 188 |
186 base::MessageLoopProxy* | 189 base::MessageLoopProxy* |
187 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { | 190 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { |
188 return ipc_message_loop_; | 191 return ipc_message_loop_; |
189 } | 192 } |
190 | 193 |
191 base::WaitableEvent* | 194 base::WaitableEvent* |
192 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { | 195 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 remote_harness_torn_down.Wait(); | 369 remote_harness_torn_down.Wait(); |
367 | 370 |
368 local_harness_->TearDownHarness(); | 371 local_harness_->TearDownHarness(); |
369 | 372 |
370 io_thread_.Stop(); | 373 io_thread_.Stop(); |
371 } | 374 } |
372 | 375 |
373 | 376 |
374 } // namespace proxy | 377 } // namespace proxy |
375 } // namespace pp | 378 } // namespace pp |
OLD | NEW |