| 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 "ipc/ipc_test_sink.h" | 5 #include "ipc/ipc_test_sink.h" |
| 6 #include "ppapi/c/dev/ppp_class_deprecated.h" | 6 #include "ppapi/c/dev/ppp_class_deprecated.h" |
| 7 #include "ppapi/proxy/plugin_var_tracker.h" | 7 #include "ppapi/proxy/plugin_var_tracker.h" |
| 8 #include "ppapi/proxy/ppapi_messages.h" | 8 #include "ppapi/proxy/ppapi_messages.h" |
| 9 #include "ppapi/proxy/ppapi_proxy_test.h" | 9 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 10 #include "ppapi/proxy/proxy_object_var.h" | 10 #include "ppapi/proxy/proxy_object_var.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 // Asserts that there is a unique "release object" IPC message in the test | 51 // Asserts that there is a unique "release object" IPC message in the test |
| 52 // sink. This will return the var ID from the message or -1 if none found. | 52 // sink. This will return the var ID from the message or -1 if none found. |
| 53 int32 GetObjectIDForUniqueReleaseObject() { | 53 int32 GetObjectIDForUniqueReleaseObject() { |
| 54 const IPC::Message* release_msg = sink().GetUniqueMessageMatching( | 54 const IPC::Message* release_msg = sink().GetUniqueMessageMatching( |
| 55 PpapiHostMsg_PPBVar_ReleaseObject::ID); | 55 PpapiHostMsg_PPBVar_ReleaseObject::ID); |
| 56 if (!release_msg) | 56 if (!release_msg) |
| 57 return -1; | 57 return -1; |
| 58 | 58 |
| 59 Tuple1<int64> id; | 59 Tuple<int64> id; |
| 60 PpapiHostMsg_PPBVar_ReleaseObject::Read(release_msg, &id); | 60 PpapiHostMsg_PPBVar_ReleaseObject::Read(release_msg, &id); |
| 61 return id.a; | 61 return get<0>(id); |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 TEST_F(PluginVarTrackerTest, GetHostObject) { | 65 TEST_F(PluginVarTrackerTest, GetHostObject) { |
| 66 ProxyAutoLock lock; | 66 ProxyAutoLock lock; |
| 67 PP_Var host_object = MakeObject(12345); | 67 PP_Var host_object = MakeObject(12345); |
| 68 | 68 |
| 69 // Round-trip through the tracker to make sure the host object comes out the | 69 // Round-trip through the tracker to make sure the host object comes out the |
| 70 // other end. | 70 // other end. |
| 71 PP_Var plugin_object = var_tracker().ReceiveObjectPassRef( | 71 PP_Var plugin_object = var_tracker().ReceiveObjectPassRef( |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 // Release the plugin ref to the var. Since the instance is gone this should | 240 // Release the plugin ref to the var. Since the instance is gone this should |
| 241 // call deallocate. | 241 // call deallocate. |
| 242 object = NULL; | 242 object = NULL; |
| 243 var_tracker().ReleaseVar(plugin_var); | 243 var_tracker().ReleaseVar(plugin_var); |
| 244 EXPECT_EQ(1, deallocate_called); | 244 EXPECT_EQ(1, deallocate_called); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace proxy | 247 } // namespace proxy |
| 248 } // namespace ppapi | 248 } // namespace ppapi |
| OLD | NEW |