OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef NET_BASE_TEST_COMPLETION_CALLBACK_H_ | 5 #ifndef NET_BASE_TEST_COMPLETION_CALLBACK_H_ |
6 #define NET_BASE_TEST_COMPLETION_CALLBACK_H_ | 6 #define NET_BASE_TEST_COMPLETION_CALLBACK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback_old.h" |
| 10 #include "base/tuple.h" |
10 | 11 |
11 //----------------------------------------------------------------------------- | 12 //----------------------------------------------------------------------------- |
12 // completion callback helper | 13 // completion callback helper |
13 | 14 |
14 // A helper class for completion callbacks, designed to make it easy to run | 15 // A helper class for completion callbacks, designed to make it easy to run |
15 // tests involving asynchronous operations. Just call WaitForResult to wait | 16 // tests involving asynchronous operations. Just call WaitForResult to wait |
16 // for the asynchronous operation to complete. | 17 // for the asynchronous operation to complete. |
17 // | 18 // |
18 // NOTE: Since this runs a message loop to wait for the completion callback, | 19 // NOTE: Since this runs a message loop to wait for the completion callback, |
19 // there could be other side-effects resulting from WaitForResult. For this | 20 // there could be other side-effects resulting from WaitForResult. For this |
(...skipping 12 matching lines...) Expand all Loading... |
32 | 33 |
33 virtual void RunWithParams(const Tuple1<int>& params); | 34 virtual void RunWithParams(const Tuple1<int>& params); |
34 | 35 |
35 private: | 36 private: |
36 int result_; | 37 int result_; |
37 bool have_result_; | 38 bool have_result_; |
38 bool waiting_for_result_; | 39 bool waiting_for_result_; |
39 }; | 40 }; |
40 | 41 |
41 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_ | 42 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_ |
OLD | NEW |