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

Unified Diff: ppapi/shared_impl/var_tracker_unittest.cc

Issue 19492014: PPAPI: Purposely leak ProxyLock, fix shutdown race (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove static initializer Created 7 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/shared_impl/tracked_callback_unittest.cc ('k') | ppapi/shared_impl/var_value_conversions_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/var_tracker_unittest.cc
diff --git a/ppapi/shared_impl/var_tracker_unittest.cc b/ppapi/shared_impl/var_tracker_unittest.cc
index 23e2f59d94872dd1bb697ac890d3787ea63037a8..0fe1a03b39686e2eb9a2ac1118904990c1363c1a 100644
--- a/ppapi/shared_impl/var_tracker_unittest.cc
+++ b/ppapi/shared_impl/var_tracker_unittest.cc
@@ -5,6 +5,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "base/compiler_specific.h"
+#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/shared_impl/var_tracker.h"
#include "ppapi/shared_impl/test_globals.h"
@@ -53,6 +54,7 @@ class VarTrackerTest : public testing::Test {
// Test implementation.
virtual void SetUp() OVERRIDE {
ASSERT_EQ(0, mock_var_alive_count);
+ ProxyLock::EnableLockingOnThreadForTest();
}
virtual void TearDown() OVERRIDE {
}
@@ -66,6 +68,7 @@ class VarTrackerTest : public testing::Test {
// Test that ResetVarID is called when the last PP_Var ref was deleted but the
// object lives on.
TEST_F(VarTrackerTest, LastResourceRef) {
+ ProxyAutoLock lock;
scoped_refptr<MockStringVar> var(new MockStringVar(std::string("xyz")));
PP_Var pp_var = var->GetPPVar();
EXPECT_TRUE(var->HasValidVarID());
@@ -82,6 +85,7 @@ TEST_F(VarTrackerTest, LastResourceRef) {
}
TEST_F(VarTrackerTest, GetPluginRefAgain) {
+ ProxyAutoLock lock;
scoped_refptr<MockStringVar> var(new MockStringVar(std::string("xyz")));
PP_Var pp_var = var->GetPPVar();
EXPECT_TRUE(var_tracker().ReleaseVar(pp_var));
@@ -112,6 +116,7 @@ TEST_F(VarTrackerTest, GetPluginRefAgain) {
// Tests when the plugin is holding a ref to a PP_Var when the instance is
// owned only by VarTracker.
TEST_F(VarTrackerTest, PluginRefWithoutVarRef) {
+ ProxyAutoLock lock;
// Make a PP_Var with one ref held by the plugin, and release the reference.
scoped_refptr<MockStringVar> var(new MockStringVar(std::string("zzz")));
PP_Var pp_var = var->GetPPVar();
@@ -129,6 +134,7 @@ TEST_F(VarTrackerTest, PluginRefWithoutVarRef) {
// Tests on Var having type of PP_VARTYPE_OBJECT.
TEST_F(VarTrackerTest, ObjectRef) {
+ ProxyAutoLock lock;
scoped_refptr<MockObjectVar> var(new MockObjectVar());
PP_Var pp_var = var->GetPPVar();
EXPECT_TRUE(var_tracker().ReleaseVar(pp_var));
« no previous file with comments | « ppapi/shared_impl/tracked_callback_unittest.cc ('k') | ppapi/shared_impl/var_value_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698