summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 00:55:42 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 00:55:42 +0000
commitd57fd38fb40a6bb65af7ab40cacd90c350c0aba1 (patch)
tree5533995be16ce702a45347690fbf20b14c1805e1 /ppapi/proxy/ppp_instance_private_proxy_unittest.cc
parentf6a55b8c655441988f72fb61863fbe16d122ce69 (diff)
downloadchromium_src-d57fd38fb40a6bb65af7ab40cacd90c350c0aba1.zip
chromium_src-d57fd38fb40a6bb65af7ab40cacd90c350c0aba1.tar.gz
chromium_src-d57fd38fb40a6bb65af7ab40cacd90c350c0aba1.tar.bz2
Various fixes to make ppapi_unittests pass again.
The following fixes are contained in this patch: -Construction/destruction of ppapi globals has been moved to the thread on which those globals are used (to prevent thread-safety CHECKs firing). -Some tests for the state of the var tracker in the plugin have been moved onto the plugin thread (to prevent thread-safety CHECKs firing). -Fixed a crash in ppp_instance_private_proxy_unittest.cc which was due to not passing a |PPP_Class_Deprecated| to |PPB_Var_Deprecated->CreateObject| which is required when deleting a var on the plugin side. -Set up a |PluginProxyDelegate| in |PluginGlobals| so that a channel to the browser can be correctly obtained for unittests. BUG=none TEST=Ran ppapi_unittests Review URL: https://chromiumcodereview.appspot.com/10913258 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppp_instance_private_proxy_unittest.cc')
-rw-r--r--ppapi/proxy/ppp_instance_private_proxy_unittest.cc34
1 files changed, 31 insertions, 3 deletions
diff --git a/ppapi/proxy/ppp_instance_private_proxy_unittest.cc b/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
index 957a3a7..58bac92 100644
--- a/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
+++ b/ppapi/proxy/ppp_instance_private_proxy_unittest.cc
@@ -66,6 +66,24 @@ PPP_Instance_Private ppp_instance_private_mock = {
&GetInstanceObject
};
+// We need to pass in a |PPP_Class_Deprecated| to
+// |PPB_Var_Deprecated->CreateObject| for a mock |Deallocate| method.
+void Deallocate(void* object) {
+}
+
+const PPP_Class_Deprecated ppp_class_deprecated_mock = {
+ NULL, // HasProperty
+ NULL, // HasMethod
+ NULL, // GetProperty
+ NULL, // GetAllPropertyNames
+ NULL, // SetProperty
+ NULL, // RemoveProperty
+ NULL, // Call
+ NULL, // Construct
+ &Deallocate
+};
+
+
// We need to mock PPP_Instance, so that we can create and destroy the pretend
// instance that PPP_Instance_Private uses.
PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/,
@@ -73,7 +91,9 @@ PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/,
// Create an object var. This should exercise the typical path for creating
// instance objects.
instance_obj =
- plugin_var_deprecated_if()->CreateObject(kInstance, NULL, NULL);
+ plugin_var_deprecated_if()->CreateObject(kInstance,
+ &ppp_class_deprecated_mock,
+ NULL);
return PP_TRUE;
}
@@ -110,8 +130,6 @@ const PPB_Var_Deprecated ppb_var_deprecated_mock = {
&CreateObject
};
-} // namespace
-
class PPP_Instance_Private_ProxyTest : public TwoWayTest {
public:
PPP_Instance_Private_ProxyTest()
@@ -125,7 +143,17 @@ class PPP_Instance_Private_ProxyTest : public TwoWayTest {
}
};
+} // namespace
+
+// TODO(raymes): This #ifdef is only here because we check the state of the
+// plugin globals on the main thread, rather than the plugin thread which causes
+// the thread checker to fail. Once ENABLE_PEPPER_THREADING is the default,
+// this will be safe to do anyway, so we can remove this.
+#ifdef ENABLE_PEPPER_THREADING
TEST_F(PPP_Instance_Private_ProxyTest, PPPInstancePrivate) {
+#else
+TEST_F(PPP_Instance_Private_ProxyTest, DISABLED_PPPInstancePrivate) {
+#endif
// This test controls its own instance; we can't use the one that
// PluginProxyTestHarness provides.
ASSERT_NE(kInstance, pp_instance());