1 // Copyright 2014 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 CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_
9 #include "base/callback.h"
10 #include "content/public/browser/browser_thread.h"
14 template <typename Arg
>
15 void ReceiveResult(BrowserThread::ID run_quit_thread
,
16 const base::Closure
& quit
,
17 Arg
* out
, Arg actual
) {
20 BrowserThread::PostTask(run_quit_thread
, FROM_HERE
, quit
);
23 template <typename Arg
> base::Callback
<void(Arg
)>
24 CreateReceiver(BrowserThread::ID run_quit_thread
,
25 const base::Closure
& quit
, Arg
* out
) {
26 return base::Bind(&ReceiveResult
<Arg
>, run_quit_thread
, quit
, out
);
29 template <typename Arg
> base::Callback
<void(Arg
)>
30 CreateReceiverOnCurrentThread(Arg
* out
) {
32 bool ret
= BrowserThread::GetCurrentThreadIdentifier(&id
);
34 return base::Bind(&ReceiveResult
<Arg
>, id
, base::Closure(), out
);
37 } // namespace content
39 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_