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

Side by Side Diff: webkit/plugins/ppapi/host_var_tracker_unittest.cc

Issue 19800005: Hide knowledge of webkit::ppapi::PluginDelegate from chrome. This is part of moving ppapi implement… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
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 "webkit/plugins/ppapi/ppapi_unittest.h" 5 #include "webkit/plugins/ppapi/ppapi_unittest.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/c/ppp_instance.h" 9 #include "ppapi/c/ppp_instance.h"
10 #include "third_party/npapi/bindings/npruntime.h" 10 #include "third_party/npapi/bindings/npruntime.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 HostVarTracker& tracker() { 80 HostVarTracker& tracker() {
81 return *HostGlobals::Get()->host_var_tracker(); 81 return *HostGlobals::Get()->host_var_tracker();
82 } 82 }
83 }; 83 };
84 84
85 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) { 85 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) {
86 // Make a second instance (the test harness already creates & manages one). 86 // Make a second instance (the test harness already creates & manages one).
87 scoped_refptr<PluginInstance> instance2( 87 scoped_refptr<PluginInstance> instance2(
88 PluginInstance::Create(delegate(), module(), NULL, GURL())); 88 PluginInstance::Create(delegate(), NULL, module(), NULL, GURL()));
89 PP_Instance pp_instance2 = instance2->pp_instance(); 89 PP_Instance pp_instance2 = instance2->pp_instance();
90 90
91 // Make an object var. 91 // Make an object var.
92 NPObjectReleaser npobject(NewTrackedNPObject()); 92 NPObjectReleaser npobject(NewTrackedNPObject());
93 NPObjectToPPVarForTest(instance2.get(), npobject.get()); 93 NPObjectToPPVarForTest(instance2.get(), npobject.get());
94 94
95 EXPECT_EQ(1, g_npobjects_alive); 95 EXPECT_EQ(1, g_npobjects_alive);
96 EXPECT_EQ(1, tracker().GetLiveNPObjectVarsForInstance(pp_instance2)); 96 EXPECT_EQ(1, tracker().GetLiveNPObjectVarsForInstance(pp_instance2));
97 97
98 // Free the instance, this should release the ObjectVar. 98 // Free the instance, this should release the ObjectVar.
(...skipping 30 matching lines...) Expand all
129 129
130 // Releasing the resource should free the internal ref, and so making a new 130 // Releasing the resource should free the internal ref, and so making a new
131 // one now should generate a new ID. 131 // one now should generate a new ID.
132 PP_Var pp_object3 = NPObjectToPPVarForTest(instance(), npobject.get()); 132 PP_Var pp_object3 = NPObjectToPPVarForTest(instance(), npobject.get());
133 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id); 133 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)); 134 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object3.value.as_id));
135 } 135 }
136 136
137 } // namespace ppapi 137 } // namespace ppapi
138 } // namespace webkit 138 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698