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

Unified Diff: ppapi/proxy/ppp_messaging_proxy_unittest.cc

Issue 10913258: Various fixes to make ppapi_unittests pass again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 | « ppapi/proxy/ppp_instance_private_proxy_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppp_messaging_proxy_unittest.cc
diff --git a/ppapi/proxy/ppp_messaging_proxy_unittest.cc b/ppapi/proxy/ppp_messaging_proxy_unittest.cc
index 8e46a4a3d957265185110ca42c64527b79b2d08a..98cfadd10d1e3a45c639ec201c12b39b033f99ed 100644
--- a/ppapi/proxy/ppp_messaging_proxy_unittest.cc
+++ b/ppapi/proxy/ppp_messaging_proxy_unittest.cc
@@ -41,8 +41,6 @@ PPP_Messaging ppp_messaging_mock = {
&HandleMessage
};
-} // namespace
-
class PPP_Messaging_ProxyTest : public TwoWayTest {
public:
PPP_Messaging_ProxyTest()
@@ -52,6 +50,21 @@ class PPP_Messaging_ProxyTest : public TwoWayTest {
}
};
+void CompareAndReleaseStringVar(PluginProxyTestHarness* plugin_harness,
+ PP_Var received_var,
+ const std::string& test_string) {
+ Var* received_string = plugin_harness->var_tracker().GetVar(received_var);
+ ASSERT_TRUE(received_string);
+ ASSERT_TRUE(received_string->AsStringVar());
+ EXPECT_EQ(test_string, received_string->AsStringVar()->value());
+ // Now release the var, and the string should go away (because the ref
+ // count should be one).
+ plugin_harness->var_tracker().ReleaseVar(received_var);
+ EXPECT_FALSE(StringVar::FromPPVar(received_var));
+}
+
+} // namespace
+
TEST_F(PPP_Messaging_ProxyTest, SendMessages) {
// Grab the host-side proxy of ppp_messaging.
const PPP_Messaging* ppp_messaging = static_cast<const PPP_Messaging*>(
@@ -109,14 +122,11 @@ TEST_F(PPP_Messaging_ProxyTest, SendMessages) {
handle_message_called.Wait();
EXPECT_EQ(expected_instance, received_instance);
EXPECT_EQ(expected_var.type, received_var.type);
- Var* received_string = plugin().var_tracker().GetVar(received_var);
- ASSERT_TRUE(received_string);
- ASSERT_TRUE(received_string->AsStringVar());
- EXPECT_EQ(kTestString, received_string->AsStringVar()->value());
- // Now release the var, and the string should go away (because the ref
- // count should be one).
- plugin().var_tracker().ReleaseVar(received_var);
- EXPECT_FALSE(StringVar::FromPPVar(received_var));
+ PostTaskOnRemoteHarness(
+ base::Bind(CompareAndReleaseStringVar,
+ &plugin(),
+ received_var,
+ kTestString));
}
} // namespace proxy
« no previous file with comments | « ppapi/proxy/ppp_instance_private_proxy_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698