OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
11 | 13 |
12 namespace base { | 14 namespace base { |
13 class RunLoop; | 15 class RunLoop; |
14 } | 16 } |
15 | 17 |
16 namespace fileapi { | 18 namespace fileapi { |
17 class FileSystemURL; | 19 class FileSystemURL; |
18 } | 20 } |
19 | 21 |
20 namespace sync_file_system { | 22 namespace sync_file_system { |
21 | 23 |
22 template <typename T> | 24 template <typename T> |
23 struct TypeTraits { | 25 struct TypeTraits { |
24 typedef T ParamType; | 26 typedef T ParamType; |
25 }; | 27 }; |
26 | 28 |
27 template <> | 29 template <> |
28 struct TypeTraits<fileapi::FileSystemURL> { | 30 struct TypeTraits<fileapi::FileSystemURL> { |
29 typedef const fileapi::FileSystemURL& ParamType; | 31 typedef const fileapi::FileSystemURL& ParamType; |
30 }; | 32 }; |
31 | 33 |
| 34 template <typename T> |
| 35 struct TypeTraits<std::vector<T> > { |
| 36 typedef const std::vector<T>& ParamType; |
| 37 }; |
| 38 |
32 template <typename Arg1, typename Arg2, typename Param1, typename Param2> | 39 template <typename Arg1, typename Arg2, typename Param1, typename Param2> |
33 void ReceiveResult2(bool* done, | 40 void ReceiveResult2(bool* done, |
34 Arg1* arg1_out, | 41 Arg1* arg1_out, |
35 Arg2* arg2_out, | 42 Arg2* arg2_out, |
36 Param1 arg1, | 43 Param1 arg1, |
37 Param2 arg2) { | 44 Param2 arg2) { |
38 EXPECT_FALSE(*done); | 45 EXPECT_FALSE(*done); |
39 *done = true; | 46 *done = true; |
40 *arg1_out = base::internal::CallbackForward(arg1); | 47 *arg1_out = base::internal::CallbackForward(arg1); |
41 *arg2_out = base::internal::CallbackForward(arg2); | 48 *arg2_out = base::internal::CallbackForward(arg2); |
(...skipping 17 matching lines...) Expand all Loading... |
59 typedef typename TypeTraits<Arg1>::ParamType Param1; | 66 typedef typename TypeTraits<Arg1>::ParamType Param1; |
60 typedef typename TypeTraits<Arg2>::ParamType Param2; | 67 typedef typename TypeTraits<Arg2>::ParamType Param2; |
61 return base::Bind(&ReceiveResult2<Arg1, Arg2, Param1, Param2>, | 68 return base::Bind(&ReceiveResult2<Arg1, Arg2, Param1, Param2>, |
62 base::Owned(new bool(false)), | 69 base::Owned(new bool(false)), |
63 arg1_out, arg2_out); | 70 arg1_out, arg2_out); |
64 } | 71 } |
65 | 72 |
66 } // namespace sync_file_system | 73 } // namespace sync_file_system |
67 | 74 |
68 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_ | 75 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_ |
OLD | NEW |