Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / sync_file_system / sync_file_system_test_util.h
blob346b365be41ffed30346d8c90c056c123a45071d
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_
8 #include <vector>
10 #include "base/bind.h"
11 #include "base/callback.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace base {
15 class RunLoop;
18 namespace storage {
19 class FileSystemURL;
22 namespace sync_file_system {
24 template <typename T>
25 struct TypeTraits {
26 typedef T ParamType;
29 template <>
30 struct TypeTraits<storage::FileSystemURL> {
31 typedef const storage::FileSystemURL& ParamType;
34 template <typename T>
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,
41 Arg1* arg1_out,
42 Arg2* arg2_out,
43 Param1 arg1,
44 Param2 arg2) {
45 EXPECT_FALSE(*done);
46 *done = true;
47 *arg1_out = base::internal::CallbackForward(arg1);
48 *arg2_out = base::internal::CallbackForward(arg2);
51 template <typename R>
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,
65 Arg2* arg2_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)),
70 arg1_out, arg2_out);
73 } // namespace sync_file_system
75 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_TEST_UTIL_H_