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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "ppapi/c/dev/ppb_var_deprecated.h" | 9 #include "ppapi/c/dev/ppb_var_deprecated.h" |
10 #include "ppapi/c/dev/ppp_class_deprecated.h" | 10 #include "ppapi/c/dev/ppp_class_deprecated.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 plugin_dispatcher->GetBrowserInterface( | 51 plugin_dispatcher->GetBrowserInterface( |
52 PPB_VAR_DEPRECATED_INTERFACE)); | 52 PPB_VAR_DEPRECATED_INTERFACE)); |
53 } | 53 } |
54 | 54 |
55 // Mock PPP_Instance_Private. | 55 // Mock PPP_Instance_Private. |
56 PP_Var instance_obj; | 56 PP_Var instance_obj; |
57 PP_Var GetInstanceObject(PP_Instance /*instance*/) { | 57 PP_Var GetInstanceObject(PP_Instance /*instance*/) { |
58 // The 1 ref we got from CreateObject will be passed to the host. We want to | 58 // The 1 ref we got from CreateObject will be passed to the host. We want to |
59 // have a ref of our own. | 59 // have a ref of our own. |
60 printf("GetInstanceObject called\n"); | 60 printf("GetInstanceObject called\n"); |
61 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(instance_obj); | 61 plugin_var_deprecated_if()->AddRef(instance_obj); |
62 return instance_obj; | 62 return instance_obj; |
63 } | 63 } |
64 | 64 |
65 PPP_Instance_Private ppp_instance_private_mock = { | 65 PPP_Instance_Private ppp_instance_private_mock = { |
66 &GetInstanceObject | 66 &GetInstanceObject |
67 }; | 67 }; |
68 | 68 |
69 // We need to mock PPP_Instance, so that we can create and destroy the pretend | 69 // We need to mock PPP_Instance, so that we can create and destroy the pretend |
70 // instance that PPP_Instance_Private uses. | 70 // instance that PPP_Instance_Private uses. |
71 PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/, | 71 PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // Destroy the instance. DidDestroy above decrements the reference count for | 175 // Destroy the instance. DidDestroy above decrements the reference count for |
176 // instance_obj, so it should also be destroyed. | 176 // instance_obj, so it should also be destroyed. |
177 ppp_instance->DidDestroy(kInstance); | 177 ppp_instance->DidDestroy(kInstance); |
178 EXPECT_EQ(-1, plugin().var_tracker().GetRefCountForObject(instance_obj)); | 178 EXPECT_EQ(-1, plugin().var_tracker().GetRefCountForObject(instance_obj)); |
179 EXPECT_EQ(-1, host().var_tracker().GetRefCountForObject(host_pp_var)); | 179 EXPECT_EQ(-1, host().var_tracker().GetRefCountForObject(host_pp_var)); |
180 } | 180 } |
181 | 181 |
182 } // namespace proxy | 182 } // namespace proxy |
183 } // namespace ppapi | 183 } // namespace ppapi |
184 | 184 |
OLD | NEW |