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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 // GetInterface handlers (for TwoWayTest). In the latter case, one handler is | 56 // GetInterface handlers (for TwoWayTest). In the latter case, one handler is |
57 // for the PluginProxyTestHarness and should only respond for PPP interfaces, | 57 // for the PluginProxyTestHarness and should only respond for PPP interfaces, |
58 // and the other handler is for the HostProxyTestHarness which should only | 58 // and the other handler is for the HostProxyTestHarness which should only |
59 // ever respond for PPB interfaces. | 59 // ever respond for PPB interfaces. |
60 ObserverList<ProxyTestHarnessBase> get_interface_handlers_; | 60 ObserverList<ProxyTestHarnessBase> get_interface_handlers_; |
61 | 61 |
62 const void* MockGetInterface(const char* name) { | 62 const void* MockGetInterface(const char* name) { |
63 ObserverList<ProxyTestHarnessBase>::Iterator it = | 63 ObserverList<ProxyTestHarnessBase>::Iterator it = |
64 get_interface_handlers_; | 64 get_interface_handlers_; |
65 while (ProxyTestHarnessBase* observer = it.GetNext()) { | 65 while (ProxyTestHarnessBase* observer = it.GetNext()) { |
66 const void* interface = observer->GetInterface(name); | 66 const void* iface = observer->GetInterface(name); |
jeanluc1
2011/08/22 22:20:24
I find the abbreviation 'iface' cryptic. I would
Jói
2011/08/24 13:56:33
Done.
| |
67 if (interface) | 67 if (iface) |
68 return interface; | 68 return iface; |
69 } | 69 } |
70 if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) | 70 if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) |
71 return &ppb_proxy_private; | 71 return &ppb_proxy_private; |
72 return NULL; | 72 return NULL; |
73 } | 73 } |
74 | 74 |
75 void SetUpRemoteHarness(ProxyTestHarnessBase* harness, | 75 void SetUpRemoteHarness(ProxyTestHarnessBase* harness, |
76 const IPC::ChannelHandle& handle, | 76 const IPC::ChannelHandle& handle, |
77 base::MessageLoopProxy* ipc_message_loop_proxy, | 77 base::MessageLoopProxy* ipc_message_loop_proxy, |
78 base::WaitableEvent* shutdown_event, | 78 base::WaitableEvent* shutdown_event, |
(...skipping 20 matching lines...) Expand all Loading... | |
99 | 99 |
100 ProxyTestHarnessBase::~ProxyTestHarnessBase() { | 100 ProxyTestHarnessBase::~ProxyTestHarnessBase() { |
101 get_interface_handlers_.RemoveObserver(this); | 101 get_interface_handlers_.RemoveObserver(this); |
102 } | 102 } |
103 | 103 |
104 const void* ProxyTestHarnessBase::GetInterface(const char* name) { | 104 const void* ProxyTestHarnessBase::GetInterface(const char* name) { |
105 return registered_interfaces_[name]; | 105 return registered_interfaces_[name]; |
106 } | 106 } |
107 | 107 |
108 void ProxyTestHarnessBase::RegisterTestInterface(const char* name, | 108 void ProxyTestHarnessBase::RegisterTestInterface(const char* name, |
109 const void* interface) { | 109 const void* iface) { |
jeanluc1
2011/08/22 22:20:24
I find the abbreviation 'iface' cryptic. I would
Jói
2011/08/24 13:56:33
Done, changed header file too.
| |
110 registered_interfaces_[name] = interface; | 110 registered_interfaces_[name] = iface; |
111 } | 111 } |
112 | 112 |
113 bool ProxyTestHarnessBase::SupportsInterface(const char* name) { | 113 bool ProxyTestHarnessBase::SupportsInterface(const char* name) { |
114 sink().ClearMessages(); | 114 sink().ClearMessages(); |
115 | 115 |
116 // IPC doesn't actually write to this when we send a message manually | 116 // IPC doesn't actually write to this when we send a message manually |
117 // not actually using IPC. | 117 // not actually using IPC. |
118 bool unused_result = false; | 118 bool unused_result = false; |
119 PpapiMsg_SupportsInterface msg(name, &unused_result); | 119 PpapiMsg_SupportsInterface msg(name, &unused_result); |
120 GetDispatcher()->OnMessageReceived(msg); | 120 GetDispatcher()->OnMessageReceived(msg); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 remote_harness_torn_down.Wait(); | 366 remote_harness_torn_down.Wait(); |
367 | 367 |
368 local_harness_->TearDownHarness(); | 368 local_harness_->TearDownHarness(); |
369 | 369 |
370 io_thread_.Stop(); | 370 io_thread_.Stop(); |
371 } | 371 } |
372 | 372 |
373 | 373 |
374 } // namespace proxy | 374 } // namespace proxy |
375 } // namespace pp | 375 } // namespace pp |
OLD | NEW |