| 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/location.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 mojo::GetProxy(&provider_proxy); | 65 mojo::GetProxy(&provider_proxy); |
| 66 provider->Bind(std::move(provider_proxy)); | 66 provider->Bind(std::move(provider_proxy)); |
| 67 registry->Bind(std::move(provider_request)); | 67 registry->Bind(std::move(provider_request)); |
| 68 | 68 |
| 69 std::unique_ptr<content::InterfaceRegistryAndroid> registry_android( | 69 std::unique_ptr<content::InterfaceRegistryAndroid> registry_android( |
| 70 InterfaceRegistryAndroid::Create(registry.get())); | 70 InterfaceRegistryAndroid::Create(registry.get())); |
| 71 std::unique_ptr<content::InterfaceProviderAndroid> provider_android( | 71 std::unique_ptr<content::InterfaceProviderAndroid> provider_android( |
| 72 InterfaceProviderAndroid::Create(provider.get())); | 72 InterfaceProviderAndroid::Create(provider.get())); |
| 73 | 73 |
| 74 ScopedJavaLocalRef<jobject> obj = Java_ShellMojoTestUtils_makePair( | 74 ScopedJavaLocalRef<jobject> obj = Java_ShellMojoTestUtils_makePair( |
| 75 env, registry_android->GetObj().obj(), provider_android->GetObj().obj()); | 75 env, registry_android->GetObj(), provider_android->GetObj()); |
| 76 | 76 |
| 77 test_environment->registry_wrappers.push_back(std::move(registry_android)); | 77 test_environment->registry_wrappers.push_back(std::move(registry_android)); |
| 78 test_environment->provider_wrappers.push_back(std::move(provider_android)); | 78 test_environment->provider_wrappers.push_back(std::move(provider_android)); |
| 79 test_environment->registries.push_back(std::move(registry)); | 79 test_environment->registries.push_back(std::move(registry)); |
| 80 test_environment->providers.push_back(std::move(provider)); | 80 test_environment->providers.push_back(std::move(provider)); |
| 81 | 81 |
| 82 return obj; | 82 return obj; |
| 83 } | 83 } |
| 84 | 84 |
| 85 static void RunLoop(JNIEnv* env, | 85 static void RunLoop(JNIEnv* env, |
| 86 const JavaParamRef<jclass>& jcaller, | 86 const JavaParamRef<jclass>& jcaller, |
| 87 jlong timeout_ms) { | 87 jlong timeout_ms) { |
| 88 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 88 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 89 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 89 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 90 base::TimeDelta::FromMilliseconds(timeout_ms)); | 90 base::TimeDelta::FromMilliseconds(timeout_ms)); |
| 91 base::RunLoop run_loop; | 91 base::RunLoop run_loop; |
| 92 run_loop.Run(); | 92 run_loop.Run(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool RegisterShellMojoTestUtils(JNIEnv* env) { | 95 bool RegisterShellMojoTestUtils(JNIEnv* env) { |
| 96 return RegisterNativesImpl(env); | 96 return RegisterNativesImpl(env); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace content | 99 } // namespace content |
| OLD | NEW |