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

Unified Diff: ppapi/proxy/plugin_var_tracker_unittest.cc

Issue 10678007: Invoke PluginImplementedObjectDestroyed for ppp_class deallocate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove object from global list before Deallocate Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/proxy/ppp_class_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_var_tracker_unittest.cc
diff --git a/ppapi/proxy/plugin_var_tracker_unittest.cc b/ppapi/proxy/plugin_var_tracker_unittest.cc
index 089888cec93225c596e9b25f7429a1e064466f6e..7e02393bc572fb1875b8954963a20678ab2f17ae 100644
--- a/ppapi/proxy/plugin_var_tracker_unittest.cc
+++ b/ppapi/proxy/plugin_var_tracker_unittest.cc
@@ -21,10 +21,10 @@ PP_Var MakeObject(int32 object_id) {
return ret;
}
-// A Deallocate() function for PPP_Class that just writes 1 to the given
-// pointer so we know when Deallocate was called.
+// A Deallocate() function for PPP_Class that just increments the integer
+// referenced by the pointer so we know how often Deallocate was called.
void MarkOnDeallocate(void* object) {
- *static_cast<int*>(object) = 1;
+ (*static_cast<int*>(object))++;
}
// A class that just implements MarkOnDeallocate on destruction.
@@ -203,11 +203,11 @@ TEST_F(PluginVarTrackerTest, PluginObjectInstanceDeleted) {
// we won't get a destroy call.
object = NULL;
var_tracker().ReleaseVar(plugin_var);
- EXPECT_FALSE(deallocate_called);
+ EXPECT_EQ(0, deallocate_called);
// Synthesize an instance destuction, this should call Deallocate.
var_tracker().DidDeleteInstance(pp_instance);
- EXPECT_TRUE(deallocate_called);
+ EXPECT_EQ(1, deallocate_called);
}
// Tests what happens when a plugin keeps a ref to a plugin-implemented
@@ -229,16 +229,16 @@ TEST_F(PluginVarTrackerTest, PluginObjectLeaked) {
&mark_on_deallocate_class,
user_data);
- // Destroy the innstance. This should not call deallocate since the plugin
+ // Destroy the instance. This should not call deallocate since the plugin
// still has a ref.
var_tracker().DidDeleteInstance(pp_instance);
- EXPECT_FALSE(deallocate_called);
+ EXPECT_EQ(0, deallocate_called);
// Release the plugin ref to the var. Since the instance is gone this should
// call deallocate.
object = NULL;
var_tracker().ReleaseVar(plugin_var);
- EXPECT_TRUE(deallocate_called);
+ EXPECT_EQ(1, deallocate_called);
}
} // namespace proxy
« no previous file with comments | « no previous file | ppapi/proxy/ppp_class_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698