OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "ppapi/shared_impl/proxy_lock.h" | 8 #include "ppapi/shared_impl/proxy_lock.h" |
9 #include "ppapi/shared_impl/var.h" | 9 #include "ppapi/shared_impl/var.h" |
10 #include "ppapi/shared_impl/var_tracker.h" | 10 #include "ppapi/shared_impl/var_tracker.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 class VarTrackerTest : public testing::Test { | 38 class VarTrackerTest : public testing::Test { |
39 public: | 39 public: |
40 VarTrackerTest() {} | 40 VarTrackerTest() {} |
41 | 41 |
42 // Test implementation. | 42 // Test implementation. |
43 virtual void SetUp() override { | 43 virtual void SetUp() override { |
44 ASSERT_EQ(0, mock_var_alive_count); | 44 ASSERT_EQ(0, mock_var_alive_count); |
| 45 ProxyLock::EnableLockingOnThreadForTest(); |
45 } | 46 } |
46 virtual void TearDown() override {} | 47 virtual void TearDown() override {} |
47 | 48 |
48 VarTracker& var_tracker() { return *globals_.GetVarTracker(); } | 49 VarTracker& var_tracker() { return *globals_.GetVarTracker(); } |
49 | 50 |
50 private: | 51 private: |
51 TestGlobals globals_; | 52 TestGlobals globals_; |
52 }; | 53 }; |
53 | 54 |
54 // Test that ResetVarID is called when the last PP_Var ref was deleted but the | 55 // Test that ResetVarID is called when the last PP_Var ref was deleted but the |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 another_var = NULL; | 143 another_var = NULL; |
143 EXPECT_TRUE(var_tracker().GetVar(pp_var)); | 144 EXPECT_TRUE(var_tracker().GetVar(pp_var)); |
144 EXPECT_EQ(1, mock_var_alive_count); | 145 EXPECT_EQ(1, mock_var_alive_count); |
145 | 146 |
146 // Releasing plugin reference. | 147 // Releasing plugin reference. |
147 EXPECT_TRUE(var_tracker().ReleaseVar(pp_var)); | 148 EXPECT_TRUE(var_tracker().ReleaseVar(pp_var)); |
148 EXPECT_EQ(0, mock_var_alive_count); | 149 EXPECT_EQ(0, mock_var_alive_count); |
149 } | 150 } |
150 | 151 |
151 } // namespace ppapi | 152 } // namespace ppapi |
OLD | NEW |