Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: ppapi/proxy/ppp_instance_private_proxy_unittest.cc

Issue 8344025: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_video_capture_proxy.cc ('k') | ppapi/proxy/ppp_instance_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/c/dev/ppb_var_deprecated.h" 5 #include "ppapi/c/dev/ppb_var_deprecated.h"
6 #include "ppapi/c/dev/ppp_class_deprecated.h" 6 #include "ppapi/c/dev/ppp_class_deprecated.h"
7 #include "ppapi/c/pp_var.h" 7 #include "ppapi/c/pp_var.h"
8 #include "ppapi/c/ppb_var.h" 8 #include "ppapi/c/ppb_var.h"
9 #include "ppapi/c/ppp_instance.h" 9 #include "ppapi/c/ppp_instance.h"
10 #include "ppapi/c/private/ppp_instance_private.h" 10 #include "ppapi/c/private/ppp_instance_private.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( 149 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>(
150 host().host_dispatcher()->GetProxiedInterface( 150 host().host_dispatcher()->GetProxiedInterface(
151 PPP_INSTANCE_INTERFACE_1_0)); 151 PPP_INSTANCE_INTERFACE_1_0));
152 152
153 // Initialize an Instance, so that the plugin-side machinery will work 153 // Initialize an Instance, so that the plugin-side machinery will work
154 // properly. 154 // properly.
155 EXPECT_EQ(PP_TRUE, ppp_instance->DidCreate(kInstance, 0, NULL, NULL)); 155 EXPECT_EQ(PP_TRUE, ppp_instance->DidCreate(kInstance, 0, NULL, NULL));
156 156
157 // Now instance_obj is valid and should have a ref-count of 1. 157 // Now instance_obj is valid and should have a ref-count of 1.
158 PluginVarTracker& plugin_var_tracker = 158 PluginVarTracker& plugin_var_tracker =
159 PluginResourceTracker::GetInstance()->var_tracker(); 159 *PluginGlobals::Get()->plugin_var_tracker();
160 // Check the plugin-side reference count. 160 // Check the plugin-side reference count.
161 EXPECT_EQ(1, plugin_var_tracker.GetRefCountForObject(instance_obj)); 161 EXPECT_EQ(1, plugin_var_tracker.GetRefCountForObject(instance_obj));
162 // Check the host-side var and reference count. 162 // Check the host-side var and reference count.
163 ASSERT_EQ(1u, id_refcount_map.size()); 163 ASSERT_EQ(1u, id_refcount_map.size());
164 EXPECT_EQ(plugin_var_tracker.GetHostObject(instance_obj).value.as_id, 164 EXPECT_EQ(plugin_var_tracker.GetHostObject(instance_obj).value.as_id,
165 id_refcount_map.begin()->first); 165 id_refcount_map.begin()->first);
166 EXPECT_EQ(0, id_refcount_map.begin()->second); 166 EXPECT_EQ(0, id_refcount_map.begin()->second);
167 167
168 // Call from the browser side to get the instance object. 168 // Call from the browser side to get the instance object.
169 PP_Var host_obj = ppp_instance_private->GetInstanceObject(kInstance); 169 PP_Var host_obj = ppp_instance_private->GetInstanceObject(kInstance);
(...skipping 12 matching lines...) Expand all
182 // instance_obj, so it should also be destroyed. 182 // instance_obj, so it should also be destroyed.
183 ppp_instance->DidDestroy(kInstance); 183 ppp_instance->DidDestroy(kInstance);
184 EXPECT_EQ(-1, plugin_var_tracker.GetRefCountForObject(instance_obj)); 184 EXPECT_EQ(-1, plugin_var_tracker.GetRefCountForObject(instance_obj));
185 // Check the host-side reference count. 185 // Check the host-side reference count.
186 EXPECT_EQ(0u, id_refcount_map.size()); 186 EXPECT_EQ(0u, id_refcount_map.size());
187 } 187 }
188 188
189 } // namespace proxy 189 } // namespace proxy
190 } // namespace ppapi 190 } // namespace ppapi
191 191
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_video_capture_proxy.cc ('k') | ppapi/proxy/ppp_instance_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698