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

Side by Side Diff: content/renderer/pepper/host_var_tracker_unittest.cc

Issue 21219002: Remove PluginDelegate completely. In a followup I'll rename PepperPluginDelegateImpl to something c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 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 | « content/renderer/pepper/host_globals.cc ('k') | content/renderer/pepper/mock_plugin_delegate.h » ('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) 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 "content/renderer/pepper/ppapi_unittest.h" 5 #include "content/renderer/pepper/ppapi_unittest.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/renderer/pepper/host_globals.h" 8 #include "content/renderer/pepper/host_globals.h"
9 #include "content/renderer/pepper/host_var_tracker.h" 9 #include "content/renderer/pepper/host_var_tracker.h"
10 #include "content/renderer/pepper/mock_plugin_delegate.h"
11 #include "content/renderer/pepper/mock_resource.h" 10 #include "content/renderer/pepper/mock_resource.h"
12 #include "content/renderer/pepper/npapi_glue.h" 11 #include "content/renderer/pepper/npapi_glue.h"
13 #include "content/renderer/pepper/npobject_var.h" 12 #include "content/renderer/pepper/npobject_var.h"
14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 13 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
15 #include "ppapi/c/pp_var.h" 14 #include "ppapi/c/pp_var.h"
16 #include "ppapi/c/ppp_instance.h" 15 #include "ppapi/c/ppp_instance.h"
17 #include "third_party/npapi/bindings/npruntime.h" 16 #include "third_party/npapi/bindings/npruntime.h"
18 #include "third_party/WebKit/public/web/WebBindings.h" 17 #include "third_party/WebKit/public/web/WebBindings.h"
19 18
20 using ppapi::NPObjectVar; 19 using ppapi::NPObjectVar;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 76 }
78 77
79 HostVarTracker& tracker() { 78 HostVarTracker& tracker() {
80 return *HostGlobals::Get()->host_var_tracker(); 79 return *HostGlobals::Get()->host_var_tracker();
81 } 80 }
82 }; 81 };
83 82
84 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) { 83 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) {
85 // Make a second instance (the test harness already creates & manages one). 84 // Make a second instance (the test harness already creates & manages one).
86 scoped_refptr<PepperPluginInstanceImpl> instance2( 85 scoped_refptr<PepperPluginInstanceImpl> instance2(
87 PepperPluginInstanceImpl::Create( 86 PepperPluginInstanceImpl::Create(NULL, NULL, module(), NULL, GURL()));
88 delegate(), NULL, module(), NULL, GURL()));
89 PP_Instance pp_instance2 = instance2->pp_instance(); 87 PP_Instance pp_instance2 = instance2->pp_instance();
90 88
91 // Make an object var. 89 // Make an object var.
92 NPObjectReleaser npobject(NewTrackedNPObject()); 90 NPObjectReleaser npobject(NewTrackedNPObject());
93 NPObjectToPPVarForTest(instance2.get(), npobject.get()); 91 NPObjectToPPVarForTest(instance2.get(), npobject.get());
94 92
95 EXPECT_EQ(1, g_npobjects_alive); 93 EXPECT_EQ(1, g_npobjects_alive);
96 EXPECT_EQ(1, tracker().GetLiveNPObjectVarsForInstance(pp_instance2)); 94 EXPECT_EQ(1, tracker().GetLiveNPObjectVarsForInstance(pp_instance2));
97 95
98 // Free the instance, this should release the ObjectVar. 96 // Free the instance, this should release the ObjectVar.
(...skipping 29 matching lines...) Expand all
128 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object1.value.as_id)); 126 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object1.value.as_id));
129 127
130 // Releasing the resource should free the internal ref, and so making a new 128 // Releasing the resource should free the internal ref, and so making a new
131 // one now should generate a new ID. 129 // one now should generate a new ID.
132 PP_Var pp_object3 = NPObjectToPPVarForTest(instance(), npobject.get()); 130 PP_Var pp_object3 = NPObjectToPPVarForTest(instance(), npobject.get());
133 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id); 131 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id);
134 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object3.value.as_id)); 132 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object3.value.as_id));
135 } 133 }
136 134
137 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/host_globals.cc ('k') | content/renderer/pepper/mock_plugin_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698