OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 TESTING_GMOCK_MUTANT_H_ | 5 #ifndef TESTING_GMOCK_MUTANT_H_ |
6 #define TESTING_GMOCK_MUTANT_H_ | 6 #define TESTING_GMOCK_MUTANT_H_ |
7 | 7 |
8 // The intention of this file is to make possible using GMock actions in | 8 // The intention of this file is to make possible using GMock actions in |
9 // all of its syntactic beauty. | 9 // all of its syntactic beauty. |
10 // | 10 // |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 private: | 106 private: |
107 base::Callback<R(Args...)> cb_; | 107 base::Callback<R(Args...)> cb_; |
108 }; | 108 }; |
109 | 109 |
110 template <typename Signature> | 110 template <typename Signature> |
111 CallbackToFunctorHelper<Signature> | 111 CallbackToFunctorHelper<Signature> |
112 CallbackToFunctor(const base::Callback<Signature>& cb) { | 112 CallbackToFunctor(const base::Callback<Signature>& cb) { |
113 return CallbackToFunctorHelper<Signature>(cb); | 113 return CallbackToFunctorHelper<Signature>(cb); |
114 } | 114 } |
115 | 115 |
| 116 template <typename Functor> |
| 117 CallbackToFunctorHelper<typename Functor::RunType> CreateFunctor( |
| 118 Functor functor) { |
| 119 return CallbackToFunctor(functor); |
| 120 } |
| 121 |
116 template <typename Functor, typename... BoundArgs> | 122 template <typename Functor, typename... BoundArgs> |
117 CallbackToFunctorHelper<base::MakeUnboundRunType<Functor, BoundArgs...>> | 123 CallbackToFunctorHelper<base::MakeUnboundRunType<Functor, BoundArgs...>> |
118 CreateFunctor(Functor functor, const BoundArgs&... args) { | 124 CreateFunctor(Functor functor, const BoundArgs&... args) { |
119 return CallbackToFunctor(base::Bind(functor, args...)); | 125 return CallbackToFunctor(base::Bind(functor, args...)); |
120 } | 126 } |
121 | 127 |
122 } // namespace testing | 128 } // namespace testing |
123 | 129 |
124 #endif // TESTING_GMOCK_MUTANT_H_ | 130 #endif // TESTING_GMOCK_MUTANT_H_ |
OLD | NEW |