| 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(); |
| 29 ProxyAutoLock lock; | 30 ProxyAutoLock lock; |
| 30 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); | 31 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); |
| 31 } | 32 } |
| 32 virtual void TearDown() override { | 33 virtual void TearDown() override { |
| 33 ProxyAutoLock lock; | 34 ProxyAutoLock lock; |
| 34 globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); | 35 globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); |
| 35 } | 36 } |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 base::MessageLoop message_loop_; | 39 base::MessageLoop message_loop_; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 resource->CheckFinalState(); | 333 resource->CheckFinalState(); |
| 333 | 334 |
| 334 // This shouldn't be needed, but make sure there are no stranded tasks. | 335 // This shouldn't be needed, but make sure there are no stranded tasks. |
| 335 { | 336 { |
| 336 ProxyAutoUnlock unlock; | 337 ProxyAutoUnlock unlock; |
| 337 base::MessageLoop::current()->RunUntilIdle(); | 338 base::MessageLoop::current()->RunUntilIdle(); |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 | 341 |
| 341 } // namespace ppapi | 342 } // namespace ppapi |
| OLD | NEW |