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