| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 template <typename Arg> base::Callback<void(Arg)> | 23 template <typename Arg> base::Callback<void(Arg)> |
| 24 CreateReceiver(BrowserThread::ID run_quit_thread, | 24 CreateReceiver(BrowserThread::ID run_quit_thread, |
| 25 const base::Closure& quit, Arg* out) { | 25 const base::Closure& quit, Arg* out) { |
| 26 return base::Bind(&ReceiveResult<Arg>, run_quit_thread, quit, out); | 26 return base::Bind(&ReceiveResult<Arg>, run_quit_thread, quit, out); |
| 27 } | 27 } |
| 28 | 28 |
| 29 template <typename Arg> base::Callback<void(Arg)> | 29 template <typename Arg> base::Callback<void(Arg)> |
| 30 CreateReceiverOnCurrentThread(Arg* out) { | 30 CreateReceiverOnCurrentThread(Arg* out) { |
| 31 BrowserThread::ID id; | 31 BrowserThread::ID id; |
| 32 BrowserThread::GetCurrentThreadIdentifier(&id); | 32 bool ret = BrowserThread::GetCurrentThreadIdentifier(&id); |
| 33 DCHECK(ret); |
| 33 return base::Bind(&ReceiveResult<Arg>, id, base::Closure(), out); | 34 return base::Bind(&ReceiveResult<Arg>, id, base::Closure(), out); |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace content | 37 } // namespace content |
| 37 | 38 |
| 38 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 39 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
| OLD | NEW |