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

Unified Diff: ppapi/proxy/serialized_var_unittest.cc

Issue 874703003: PPAPI: Release renderer Var refcount when returning to plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: ppapi/proxy/serialized_var_unittest.cc
diff --git a/ppapi/proxy/serialized_var_unittest.cc b/ppapi/proxy/serialized_var_unittest.cc
index fcde77795a37b71cf2fa5baa718b040779c420dc..94961afeb04c914c6f28718ac3bcb810bd8ac6c4 100644
--- a/ppapi/proxy/serialized_var_unittest.cc
+++ b/ppapi/proxy/serialized_var_unittest.cc
@@ -272,6 +272,18 @@ TEST_F(SerializedVarTest, PluginVectorReceiveInput) {
EXPECT_EQ(-1, var_tracker().GetRefCountForObject(plugin_objects2[1]));
}
+// Tests the browser sending a String var as a return value to make sure we
+// ref-count the host side properly.
+typedef HostProxyTest HostSerializedVarTest;
+TEST_F(HostSerializedVarTest, PluginReceiveStringReturn) {
+ PP_Var string_var = StringVar::StringToPPVar("Hello");
+ EXPECT_EQ(1, var_tracker().GetRefCountForObject(string_var));
+ GetDispatcher()->serialization_rules()->BeginSendPassRef(string_var);
+ GetDispatcher()->serialization_rules()->EndSendPassRef(string_var);
+ // It should be gone, so we should get -1 to indicate that.
+ EXPECT_EQ(-1, var_tracker().GetRefCountForObject(string_var));
raymes 2015/01/27 00:12:44 Should we test the object var case too? Or does th
+}
+
// Tests the plugin receiving a var as a return value from the browser
// two different times (passing ownership).
TEST_F(SerializedVarTest, PluginReceiveReturn) {
« ppapi/proxy/host_var_serialization_rules.cc ('K') | « ppapi/proxy/host_var_serialization_rules.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698