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
3 // found in the LICENSE file.
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_
10 #include "base/bind.h"
11 #include "base/callback.h"
12 #include "testing/gtest/include/gtest/gtest.h"
22 namespace sync_file_system
{
30 struct TypeTraits
<storage::FileSystemURL
> {
31 typedef const storage::FileSystemURL
& ParamType
;
35 struct TypeTraits
<std::vector
<T
> > {
36 typedef const std::vector
<T
>& ParamType
;
39 template <typename Arg1
, typename Arg2
, typename Param1
, typename Param2
>
40 void ReceiveResult2(bool* done
,
47 *arg1_out
= base::internal::CallbackForward(arg1
);
48 *arg2_out
= base::internal::CallbackForward(arg2
);
52 void AssignAndQuit(base::RunLoop
* run_loop
, R
* result_out
, R result
);
54 template <typename R
> base::Callback
<void(R
)>
55 AssignAndQuitCallback(base::RunLoop
* run_loop
, R
* result
);
57 template <typename Arg
>
58 base::Callback
<void(typename TypeTraits
<Arg
>::ParamType
)>
59 CreateResultReceiver(Arg
* arg_out
);
61 template <typename Arg1
, typename Arg2
>
62 base::Callback
<void(typename TypeTraits
<Arg1
>::ParamType
,
63 typename TypeTraits
<Arg2
>::ParamType
)>
64 CreateResultReceiver(Arg1
* arg1_out
,
66 typedef typename TypeTraits
<Arg1
>::ParamType Param1
;
67 typedef typename TypeTraits
<Arg2
>::ParamType Param2
;
68 return base::Bind(&ReceiveResult2
<Arg1
, Arg2
, Param1
, Param2
>,
69 base::Owned(new bool(false)),
73 } // namespace sync_file_system
75 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_