Home | History | Annotate | Download | only in sync_file_system
      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.
      4 
      5 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
      6 
      7 #include "base/bind.h"
      8 #include "base/message_loop/message_loop_proxy.h"
      9 #include "base/run_loop.h"
     10 #include "base/single_thread_task_runner.h"
     11 #include "base/threading/thread.h"
     12 #include "chrome/browser/sync_file_system/sync_status_code.h"
     13 #include "content/public/browser/browser_thread.h"
     14 #include "content/public/test/test_utils.h"
     15 
     16 using content::BrowserThread;
     17 
     18 namespace sync_file_system {
     19 
     20 template <typename R>
     21 void AssignAndQuit(base::RunLoop* run_loop, R* result_out, R result) {
     22   DCHECK(result_out);
     23   DCHECK(run_loop);
     24   *result_out = result;
     25   run_loop->Quit();
     26 }
     27 
     28 template <typename R> base::Callback<void(R)>
     29 AssignAndQuitCallback(base::RunLoop* run_loop, R* result) {
     30   return base::Bind(&AssignAndQuit<R>, run_loop, base::Unretained(result));
     31 }
     32 
     33 // Instantiate versions we know callers will need.
     34 template base::Callback<void(SyncStatusCode)>
     35 AssignAndQuitCallback(base::RunLoop*, SyncStatusCode*);
     36 
     37 }  // namespace sync_file_system
     38