| 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 <cstring> | 5 #include <cstring> |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
| 9 #include "ppapi/c/ppb_var.h" | 9 #include "ppapi/c/ppb_var.h" |
| 10 #include "ppapi/c/ppp_messaging.h" | 10 #include "ppapi/c/ppp_messaging.h" |
| 11 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/proxy/ppapi_proxy_test.h" | 12 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 13 #include "ppapi/proxy/serialized_var.h" | 13 #include "ppapi/proxy/serialized_var.h" |
| 14 #include "ppapi/shared_impl/api_id.h" | 14 #include "ppapi/shared_impl/api_id.h" |
| 15 #include "ppapi/shared_impl/proxy_lock.h" | 15 #include "ppapi/shared_impl/proxy_lock.h" |
| 16 #include "ppapi/shared_impl/var.h" | 16 #include "ppapi/shared_impl/var.h" |
| 17 | 17 |
| 18 namespace ppapi { | 18 namespace ppapi { |
| 19 namespace proxy { | 19 namespace proxy { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // This is a poor man's mock of PPP_Messaging using global variables. Eventually | 23 // This is an ad-hoc mock of PPP_Messaging using global variables. Eventually, |
| 24 // we should generalize making PPAPI interface mocks by using IDL or macro/ | 24 // generalize making PPAPI interface mocks by using IDL or macro/template magic. |
| 25 // template magic. | |
| 26 PP_Instance received_instance; | 25 PP_Instance received_instance; |
| 27 PP_Var received_var; | 26 PP_Var received_var; |
| 28 base::WaitableEvent handle_message_called( | 27 base::WaitableEvent handle_message_called( |
| 29 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 28 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 30 base::WaitableEvent::InitialState::NOT_SIGNALED); | 29 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 31 | 30 |
| 32 void HandleMessage(PP_Instance instance, PP_Var message_data) { | 31 void HandleMessage(PP_Instance instance, PP_Var message_data) { |
| 33 received_instance = instance; | 32 received_instance = instance; |
| 34 received_var = message_data; | 33 received_var = message_data; |
| 35 handle_message_called.Signal(); | 34 handle_message_called.Signal(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 PostTaskOnRemoteHarness( | 138 PostTaskOnRemoteHarness( |
| 140 base::Bind(CompareAndReleaseStringVar, | 139 base::Bind(CompareAndReleaseStringVar, |
| 141 &plugin(), | 140 &plugin(), |
| 142 received_var, | 141 received_var, |
| 143 kTestString)); | 142 kTestString)); |
| 144 } | 143 } |
| 145 | 144 |
| 146 } // namespace proxy | 145 } // namespace proxy |
| 147 } // namespace ppapi | 146 } // namespace ppapi |
| 148 | 147 |
| OLD | NEW |