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 "base/cancelable_callback.h" | 5 #include "base/cancelable_callback.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 namespace { | 20 namespace { |
21 | 21 |
22 class TestRefCounted : public RefCountedThreadSafe<TestRefCounted> { | 22 class TestRefCounted : public RefCountedThreadSafe<TestRefCounted> { |
23 private: | 23 private: |
24 friend class RefCountedThreadSafe<TestRefCounted>; | 24 friend class RefCountedThreadSafe<TestRefCounted>; |
25 ~TestRefCounted() {}; | 25 ~TestRefCounted() {}; |
26 }; | 26 }; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 int result = 0; | 196 int result = 0; |
197 CancelableCallback<void(std::unique_ptr<int>)> cb( | 197 CancelableCallback<void(std::unique_ptr<int>)> cb( |
198 base::Bind(&OnMoveOnlyReceived, base::Unretained(&result))); | 198 base::Bind(&OnMoveOnlyReceived, base::Unretained(&result))); |
199 cb.callback().Run(base::WrapUnique(new int(kExpectedResult))); | 199 cb.callback().Run(base::WrapUnique(new int(kExpectedResult))); |
200 | 200 |
201 EXPECT_EQ(kExpectedResult, result); | 201 EXPECT_EQ(kExpectedResult, result); |
202 } | 202 } |
203 | 203 |
204 } // namespace | 204 } // namespace |
205 } // namespace base | 205 } // namespace base |
OLD | NEW |