OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/shared_impl/callback_tracker.h" | 10 #include "ppapi/shared_impl/callback_tracker.h" |
11 #include "ppapi/shared_impl/proxy_lock.h" | 11 #include "ppapi/shared_impl/proxy_lock.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
13 #include "ppapi/shared_impl/resource_tracker.h" | 13 #include "ppapi/shared_impl/resource_tracker.h" |
14 #include "ppapi/shared_impl/test_globals.h" | 14 #include "ppapi/shared_impl/test_globals.h" |
15 #include "ppapi/shared_impl/tracked_callback.h" | 15 #include "ppapi/shared_impl/tracked_callback.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace ppapi { | 18 namespace ppapi { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class TrackedCallbackTest : public testing::Test { | 22 class TrackedCallbackTest : public testing::Test { |
23 public: | 23 public: |
24 TrackedCallbackTest() : pp_instance_(1234) {} | 24 TrackedCallbackTest() : pp_instance_(1234) {} |
25 | 25 |
26 PP_Instance pp_instance() const { return pp_instance_; } | 26 PP_Instance pp_instance() const { return pp_instance_; } |
27 | 27 |
28 virtual void SetUp() override { | 28 virtual void SetUp() override { |
29 ProxyLock::EnableLockingOnThreadForTest(); | |
30 ProxyAutoLock lock; | 29 ProxyAutoLock lock; |
31 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); | 30 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); |
32 } | 31 } |
33 virtual void TearDown() override { | 32 virtual void TearDown() override { |
34 ProxyAutoLock lock; | 33 ProxyAutoLock lock; |
35 globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); | 34 globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); |
36 } | 35 } |
37 | 36 |
38 private: | 37 private: |
39 base::MessageLoop message_loop_; | 38 base::MessageLoop message_loop_; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 resource->CheckFinalState(); | 332 resource->CheckFinalState(); |
334 | 333 |
335 // This shouldn't be needed, but make sure there are no stranded tasks. | 334 // This shouldn't be needed, but make sure there are no stranded tasks. |
336 { | 335 { |
337 ProxyAutoUnlock unlock; | 336 ProxyAutoUnlock unlock; |
338 base::MessageLoop::current()->RunUntilIdle(); | 337 base::MessageLoop::current()->RunUntilIdle(); |
339 } | 338 } |
340 } | 339 } |
341 | 340 |
342 } // namespace ppapi | 341 } // namespace ppapi |
OLD | NEW |