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 "content/shell/browser/shell_mojo_test_utils_android.h" | 5 #include "content/shell/browser/shell_mojo_test_utils_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/location.h" |
9 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
12 #include "content/public/browser/android/service_registry_android.h" | 15 #include "content/public/browser/android/service_registry_android.h" |
13 #include "content/public/common/service_registry.h" | 16 #include "content/public/common/service_registry.h" |
14 #include "jni/ShellMojoTestUtils_jni.h" | 17 #include "jni/ShellMojoTestUtils_jni.h" |
15 | 18 |
16 namespace { | 19 namespace { |
17 | 20 |
18 struct TestEnvironment { | 21 struct TestEnvironment { |
19 base::MessageLoop message_loop; | 22 base::MessageLoop message_loop; |
20 ScopedVector<content::ServiceRegistry> registries; | 23 ScopedVector<content::ServiceRegistry> registries; |
21 ScopedVector<content::ServiceRegistryAndroid> wrappers; | 24 ScopedVector<content::ServiceRegistryAndroid> wrappers; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ServiceRegistryAndroid::Create(registry_b).release(); | 66 ServiceRegistryAndroid::Create(registry_b).release(); |
64 test_environment->wrappers.push_back(wrapper_b); | 67 test_environment->wrappers.push_back(wrapper_b); |
65 | 68 |
66 return Java_ShellMojoTestUtils_makePair(env, wrapper_a->GetObj().obj(), | 69 return Java_ShellMojoTestUtils_makePair(env, wrapper_a->GetObj().obj(), |
67 wrapper_b->GetObj().obj()); | 70 wrapper_b->GetObj().obj()); |
68 } | 71 } |
69 | 72 |
70 static void RunLoop(JNIEnv* env, | 73 static void RunLoop(JNIEnv* env, |
71 const JavaParamRef<jclass>& jcaller, | 74 const JavaParamRef<jclass>& jcaller, |
72 jlong timeout_ms) { | 75 jlong timeout_ms) { |
73 base::MessageLoop::current()->PostDelayedTask( | 76 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
74 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 77 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
75 base::TimeDelta::FromMilliseconds(timeout_ms)); | 78 base::TimeDelta::FromMilliseconds(timeout_ms)); |
76 base::RunLoop run_loop; | 79 base::RunLoop run_loop; |
77 run_loop.Run(); | 80 run_loop.Run(); |
78 } | 81 } |
79 | 82 |
80 bool RegisterShellMojoTestUtils(JNIEnv* env) { | 83 bool RegisterShellMojoTestUtils(JNIEnv* env) { |
81 return RegisterNativesImpl(env); | 84 return RegisterNativesImpl(env); |
82 } | 85 } |
83 | 86 |
84 } // namespace content | 87 } // namespace content |
OLD | NEW |