| 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 <sstream> | 7 #include <sstream> |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // We allow multiple harnesses at a time to respond to 'GetInterface' calls. | 57 // We allow multiple harnesses at a time to respond to 'GetInterface' calls. |
| 58 // We assume that only 1 harness's GetInterface function will ever support a | 58 // We assume that only 1 harness's GetInterface function will ever support a |
| 59 // given interface name. In practice, there will either be only 1 GetInterface | 59 // given interface name. In practice, there will either be only 1 GetInterface |
| 60 // handler (for PluginProxyTest or HostProxyTest), or there will be only 2 | 60 // handler (for PluginProxyTest or HostProxyTest), or there will be only 2 |
| 61 // GetInterface handlers (for TwoWayTest). In the latter case, one handler is | 61 // GetInterface handlers (for TwoWayTest). In the latter case, one handler is |
| 62 // for the PluginProxyTestHarness and should only respond for PPP interfaces, | 62 // for the PluginProxyTestHarness and should only respond for PPP interfaces, |
| 63 // and the other handler is for the HostProxyTestHarness which should only | 63 // and the other handler is for the HostProxyTestHarness which should only |
| 64 // ever respond for PPB interfaces. | 64 // ever respond for PPB interfaces. |
| 65 ObserverList<ProxyTestHarnessBase> get_interface_handlers_; | 65 base::ObserverList<ProxyTestHarnessBase> get_interface_handlers_; |
| 66 | 66 |
| 67 const void* MockGetInterface(const char* name) { | 67 const void* MockGetInterface(const char* name) { |
| 68 ObserverList<ProxyTestHarnessBase>::Iterator it(&get_interface_handlers_); | 68 base::ObserverList<ProxyTestHarnessBase>::Iterator it( |
| 69 &get_interface_handlers_); |
| 69 while (ProxyTestHarnessBase* observer = it.GetNext()) { | 70 while (ProxyTestHarnessBase* observer = it.GetNext()) { |
| 70 const void* interface = observer->GetInterface(name); | 71 const void* interface = observer->GetInterface(name); |
| 71 if (interface) | 72 if (interface) |
| 72 return interface; | 73 return interface; |
| 73 } | 74 } |
| 74 if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) | 75 if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) |
| 75 return &ppb_proxy_private; | 76 return &ppb_proxy_private; |
| 76 return NULL; | 77 return NULL; |
| 77 } | 78 } |
| 78 | 79 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, | 603 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, |
| 603 base::Bind(&RunTaskOnRemoteHarness, | 604 base::Bind(&RunTaskOnRemoteHarness, |
| 604 task, | 605 task, |
| 605 &task_complete)); | 606 &task_complete)); |
| 606 task_complete.Wait(); | 607 task_complete.Wait(); |
| 607 } | 608 } |
| 608 | 609 |
| 609 | 610 |
| 610 } // namespace proxy | 611 } // namespace proxy |
| 611 } // namespace ppapi | 612 } // namespace ppapi |
| OLD | NEW |