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 // Illustrates how to use worker threads that issue completion callbacks | 5 // Illustrates how to use worker threads that issue completion callbacks |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
12 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
13 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
14 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "testing/platform_test.h" | 17 #include "testing/platform_test.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 EXPECT_TRUE(queued); | 147 EXPECT_TRUE(queued); |
147 | 148 |
148 EXPECT_FALSE(did_check_result); | 149 EXPECT_FALSE(did_check_result); |
149 closure.WaitForResult(); | 150 closure.WaitForResult(); |
150 EXPECT_TRUE(did_check_result); | 151 EXPECT_TRUE(did_check_result); |
151 } | 152 } |
152 | 153 |
153 // TODO: test deleting ExampleEmployer while work outstanding | 154 // TODO: test deleting ExampleEmployer while work outstanding |
154 | 155 |
155 } // namespace net | 156 } // namespace net |
OLD | NEW |