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() | 24 TrackedCallbackTest() : pp_instance_(1234) {} |
25 : message_loop_(base::MessageLoop::TYPE_DEFAULT), pp_instance_(1234) {} | |
26 | 25 |
27 PP_Instance pp_instance() const { return pp_instance_; } | 26 PP_Instance pp_instance() const { return pp_instance_; } |
28 | 27 |
29 virtual void SetUp() OVERRIDE { | 28 virtual void SetUp() OVERRIDE { |
30 ProxyLock::EnableLockingOnThreadForTest(); | 29 ProxyLock::EnableLockingOnThreadForTest(); |
31 ProxyAutoLock lock; | 30 ProxyAutoLock lock; |
32 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); | 31 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); |
33 } | 32 } |
34 virtual void TearDown() OVERRIDE { | 33 virtual void TearDown() OVERRIDE { |
35 ProxyAutoLock lock; | 34 ProxyAutoLock lock; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 resource->CheckFinalState(); | 338 resource->CheckFinalState(); |
340 | 339 |
341 // This shouldn't be needed, but make sure there are no stranded tasks. | 340 // This shouldn't be needed, but make sure there are no stranded tasks. |
342 { | 341 { |
343 ProxyAutoUnlock unlock; | 342 ProxyAutoUnlock unlock; |
344 base::MessageLoop::current()->RunUntilIdle(); | 343 base::MessageLoop::current()->RunUntilIdle(); |
345 } | 344 } |
346 } | 345 } |
347 | 346 |
348 } // namespace ppapi | 347 } // namespace ppapi |
OLD | NEW |