| 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 #include "mojo/android/javatests/mojo_test_case.h" | 5 #include "mojo/android/javatests/mojo_test_case.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 jlong test_environment) { | 47 jlong test_environment) { |
| 48 delete reinterpret_cast<TestEnvironment*>(test_environment); | 48 delete reinterpret_cast<TestEnvironment*>(test_environment); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static void RunLoop(JNIEnv* env, | 51 static void RunLoop(JNIEnv* env, |
| 52 const JavaParamRef<jobject>& jcaller, | 52 const JavaParamRef<jobject>& jcaller, |
| 53 jlong timeout_ms) { | 53 jlong timeout_ms) { |
| 54 base::RunLoop run_loop; | 54 base::RunLoop run_loop; |
| 55 if (timeout_ms) { | 55 if (timeout_ms) { |
| 56 base::MessageLoop::current()->PostDelayedTask( | 56 base::MessageLoop::current()->PostDelayedTask( |
| 57 FROM_HERE, | 57 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 58 base::MessageLoop::QuitClosure(), | |
| 59 base::TimeDelta::FromMilliseconds(timeout_ms)); | 58 base::TimeDelta::FromMilliseconds(timeout_ms)); |
| 60 run_loop.Run(); | 59 run_loop.Run(); |
| 61 } else { | 60 } else { |
| 62 run_loop.RunUntilIdle(); | 61 run_loop.RunUntilIdle(); |
| 63 } | 62 } |
| 64 } | 63 } |
| 65 | 64 |
| 66 bool RegisterMojoTestCase(JNIEnv* env) { | 65 bool RegisterMojoTestCase(JNIEnv* env) { |
| 67 return RegisterNativesImpl(env); | 66 return RegisterNativesImpl(env); |
| 68 } | 67 } |
| 69 | 68 |
| 70 } // namespace android | 69 } // namespace android |
| 71 } // namespace mojo | 70 } // namespace mojo |
| OLD | NEW |