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