Index: webkit/plugins/ppapi/resource_tracker_unittest.cc |
diff --git a/webkit/plugins/ppapi/resource_tracker_unittest.cc b/webkit/plugins/ppapi/resource_tracker_unittest.cc |
index eb7ec80c31874c500f7d21c484d45a39df3697aa..c43b1d24fd0f3d4409ffb869c89af784de5db4df 100644 |
--- a/webkit/plugins/ppapi/resource_tracker_unittest.cc |
+++ b/webkit/plugins/ppapi/resource_tracker_unittest.cc |
@@ -113,82 +113,6 @@ class ResourceTrackerTest : public PpapiUnittest { |
ResourceTracker tracker_; |
}; |
-TEST_F(ResourceTrackerTest, Ref) { |
- ASSERT_EQ(0, TrackedMockResource::tracked_objects_alive); |
- EXPECT_EQ(0u, |
- tracker().GetLiveObjectsForInstance(instance()->pp_instance())); |
- { |
- scoped_refptr<TrackedMockResource> new_resource( |
- new TrackedMockResource(instance())); |
- ASSERT_EQ(1, TrackedMockResource::tracked_objects_alive); |
- |
- // Since we haven't gotten a PP_Resource, it's not associated with the |
- // module. |
- EXPECT_EQ(0u, |
- tracker().GetLiveObjectsForInstance(instance()->pp_instance())); |
- } |
- ASSERT_EQ(0, TrackedMockResource::tracked_objects_alive); |
- |
- // Make a new resource and get it as a PP_Resource. |
- PP_Resource resource_id = 0; |
- { |
- scoped_refptr<TrackedMockResource> new_resource( |
- new TrackedMockResource(instance())); |
- ASSERT_EQ(1, TrackedMockResource::tracked_objects_alive); |
- resource_id = new_resource->GetReference(); |
- EXPECT_EQ(1u, |
- tracker().GetLiveObjectsForInstance(instance()->pp_instance())); |
- |
- // Resource IDs should be consistent. |
- PP_Resource resource_id_2 = new_resource->GetReference(); |
- ASSERT_EQ(resource_id, resource_id_2); |
- } |
- |
- // This time it should not have been deleted since the PP_Resource carries |
- // a ref. |
- ASSERT_EQ(1, TrackedMockResource::tracked_objects_alive); |
- |
- // Now we have two refs, derefing twice should delete the object. |
- tracker().UnrefResource(resource_id); |
- ASSERT_EQ(1, TrackedMockResource::tracked_objects_alive); |
- tracker().UnrefResource(resource_id); |
- ASSERT_EQ(0, TrackedMockResource::tracked_objects_alive); |
-} |
- |
-TEST_F(ResourceTrackerTest, DeleteResourceWithInstance) { |
- // Make a second instance (the test harness already creates & manages one). |
- scoped_refptr<PluginInstance> instance2( |
- PluginInstance::Create1_0(delegate(), module(), |
- GetMockInterface(PPP_INSTANCE_INTERFACE_1_0))); |
- PP_Instance pp_instance2 = instance2->pp_instance(); |
- |
- // Make two resources and take refs on behalf of the "plugin" for each. |
- scoped_refptr<TrackedMockResource> resource1( |
- new TrackedMockResource(instance2)); |
- resource1->GetReference(); |
- scoped_refptr<TrackedMockResource> resource2( |
- new TrackedMockResource(instance2)); |
- resource2->GetReference(); |
- |
- // Keep an "internal" ref to only the first (the PP_Resource also holds a |
- // ref to each resource on behalf of the plugin). |
- resource2 = NULL; |
- |
- ASSERT_EQ(2, TrackedMockResource::tracked_objects_alive); |
- EXPECT_EQ(2u, tracker().GetLiveObjectsForInstance(pp_instance2)); |
- |
- // Free the instance, this should release both plugin refs. |
- instance2 = NULL; |
- EXPECT_EQ(0u, tracker().GetLiveObjectsForInstance(pp_instance2)); |
- |
- // The resource we have a scoped_refptr to should still be alive, but it |
- // should have a NULL instance. |
- ASSERT_FALSE(resource1->instance()); |
- ASSERT_EQ(1, TrackedMockResource::tracked_objects_alive); |
- resource1 = NULL; |
- ASSERT_EQ(0, TrackedMockResource::tracked_objects_alive); |
-} |
- |
TEST_F(ResourceTrackerTest, DeleteObjectVarWithInstance) { |
// Make a second instance (the test harness already creates & manages one). |
scoped_refptr<PluginInstance> instance2( |
@@ -201,11 +125,11 @@ TEST_F(ResourceTrackerTest, DeleteObjectVarWithInstance) { |
NPObjectToPPVar(instance2.get(), npobject.get()); |
EXPECT_EQ(1, g_npobjects_alive); |
- EXPECT_EQ(1u, tracker().GetLiveObjectsForInstance(pp_instance2)); |
+ EXPECT_EQ(1, tracker().GetLiveNPObjectVarsForInstance(pp_instance2)); |
// Free the instance, this should release the ObjectVar. |
instance2 = NULL; |
- EXPECT_EQ(0u, tracker().GetLiveObjectsForInstance(pp_instance2)); |
+ EXPECT_EQ(0, tracker().GetLiveNPObjectVarsForInstance(pp_instance2)); |
} |
// Make sure that using the same NPObject should give the same PP_Var |