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/message_loop/message_loop.h" |
14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 namespace { | 21 namespace { |
21 | 22 |
22 class TestRefCounted : public RefCountedThreadSafe<TestRefCounted> { | 23 class TestRefCounted : public RefCountedThreadSafe<TestRefCounted> { |
23 private: | 24 private: |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 int result = 0; | 197 int result = 0; |
197 CancelableCallback<void(std::unique_ptr<int>)> cb( | 198 CancelableCallback<void(std::unique_ptr<int>)> cb( |
198 base::Bind(&OnMoveOnlyReceived, base::Unretained(&result))); | 199 base::Bind(&OnMoveOnlyReceived, base::Unretained(&result))); |
199 cb.callback().Run(base::WrapUnique(new int(kExpectedResult))); | 200 cb.callback().Run(base::WrapUnique(new int(kExpectedResult))); |
200 | 201 |
201 EXPECT_EQ(kExpectedResult, result); | 202 EXPECT_EQ(kExpectedResult, result); |
202 } | 203 } |
203 | 204 |
204 } // namespace | 205 } // namespace |
205 } // namespace base | 206 } // namespace base |
OLD | NEW |