| 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 #include "ppapi/proxy/ppapi_proxy_test.h" | 5 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // We assume that only 1 harness's GetInterface function will ever support a | 60 // We assume that only 1 harness's GetInterface function will ever support a |
| 61 // given interface name. In practice, there will either be only 1 GetInterface | 61 // given interface name. In practice, there will either be only 1 GetInterface |
| 62 // handler (for PluginProxyTest or HostProxyTest), or there will be only 2 | 62 // handler (for PluginProxyTest or HostProxyTest), or there will be only 2 |
| 63 // GetInterface handlers (for TwoWayTest). In the latter case, one handler is | 63 // GetInterface handlers (for TwoWayTest). In the latter case, one handler is |
| 64 // for the PluginProxyTestHarness and should only respond for PPP interfaces, | 64 // for the PluginProxyTestHarness and should only respond for PPP interfaces, |
| 65 // and the other handler is for the HostProxyTestHarness which should only | 65 // and the other handler is for the HostProxyTestHarness which should only |
| 66 // ever respond for PPB interfaces. | 66 // ever respond for PPB interfaces. |
| 67 base::ObserverList<ProxyTestHarnessBase> get_interface_handlers_; | 67 base::ObserverList<ProxyTestHarnessBase> get_interface_handlers_; |
| 68 | 68 |
| 69 const void* MockGetInterface(const char* name) { | 69 const void* MockGetInterface(const char* name) { |
| 70 base::ObserverList<ProxyTestHarnessBase>::Iterator it( | 70 for (auto& observer : get_interface_handlers_) { |
| 71 &get_interface_handlers_); | 71 const void* interface = observer.GetInterface(name); |
| 72 while (ProxyTestHarnessBase* observer = it.GetNext()) { | |
| 73 const void* interface = observer->GetInterface(name); | |
| 74 if (interface) | 72 if (interface) |
| 75 return interface; | 73 return interface; |
| 76 } | 74 } |
| 77 if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) | 75 if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) |
| 78 return &ppb_proxy_private; | 76 return &ppb_proxy_private; |
| 79 return NULL; | 77 return NULL; |
| 80 } | 78 } |
| 81 | 79 |
| 82 void SetUpRemoteHarness(ProxyTestHarnessBase* harness, | 80 void SetUpRemoteHarness(ProxyTestHarnessBase* harness, |
| 83 const IPC::ChannelHandle& handle, | 81 const IPC::ChannelHandle& handle, |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 base::WaitableEvent::ResetPolicy::MANUAL, | 582 base::WaitableEvent::ResetPolicy::MANUAL, |
| 585 base::WaitableEvent::InitialState::NOT_SIGNALED); | 583 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 586 plugin_thread_.task_runner()->PostTask( | 584 plugin_thread_.task_runner()->PostTask( |
| 587 FROM_HERE, base::Bind(&RunTaskOnRemoteHarness, task, &task_complete)); | 585 FROM_HERE, base::Bind(&RunTaskOnRemoteHarness, task, &task_complete)); |
| 588 task_complete.Wait(); | 586 task_complete.Wait(); |
| 589 } | 587 } |
| 590 | 588 |
| 591 | 589 |
| 592 } // namespace proxy | 590 } // namespace proxy |
| 593 } // namespace ppapi | 591 } // namespace ppapi |
| OLD | NEW |