Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3049)

Unified Diff: content/shell/browser/shell_mojo_test_utils_android.cc

Issue 2099063002: Migrate RenderProcessHost, ChildThread to InterfaceRegistry/Provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/shell_mojo_test_utils_android.cc
diff --git a/content/shell/browser/shell_mojo_test_utils_android.cc b/content/shell/browser/shell_mojo_test_utils_android.cc
index e51edf52b9340c277fa859cef09fb9403991d046..b2b6c92d7ac008abf90d9361494f75de0c278f56 100644
--- a/content/shell/browser/shell_mojo_test_utils_android.cc
+++ b/content/shell/browser/shell_mojo_test_utils_android.cc
@@ -13,14 +13,16 @@
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/android/service_registry_android.h"
-#include "content/public/common/service_registry.h"
#include "jni/ShellMojoTestUtils_jni.h"
+#include "services/shell/public/cpp/interface_provider.h"
+#include "services/shell/public/cpp/interface_registry.h"
namespace {
struct TestEnvironment {
base::MessageLoop message_loop;
- ScopedVector<content::ServiceRegistry> registries;
+ std::vector<std::unique_ptr<shell::InterfaceRegistry>> registries;
+ std::vector<std::unique_ptr<shell::InterfaceProvider>> providers;
ScopedVector<content::ServiceRegistryAndroid> wrappers;
};
@@ -46,28 +48,41 @@ static ScopedJavaLocalRef<jobject> CreateServiceRegistryPair(
TestEnvironment* test_environment =
reinterpret_cast<TestEnvironment*>(native_test_environment);
- content::ServiceRegistry* registry_a = ServiceRegistry::Create();
- test_environment->registries.push_back(registry_a);
- content::ServiceRegistry* registry_b = ServiceRegistry::Create();
- test_environment->registries.push_back(registry_b);
-
- shell::mojom::InterfaceProviderPtr exposed_services_a;
- registry_a->Bind(GetProxy(&exposed_services_a));
- mojo::FuseInterface(registry_b->TakeRemoteRequest(),
- exposed_services_a.PassInterface());
-
- shell::mojom::InterfaceProviderPtr exposed_services_b;
- registry_b->Bind(GetProxy(&exposed_services_b));
- mojo::FuseInterface(registry_a->TakeRemoteRequest(),
- exposed_services_b.PassInterface());
+ std::unique_ptr<shell::InterfaceRegistry> registry_a(
+ new shell::InterfaceRegistry(nullptr));
+ std::unique_ptr<shell::InterfaceRegistry> registry_b(
+ new shell::InterfaceRegistry(nullptr));
+ std::unique_ptr<shell::InterfaceProvider> provider_a(
+ new shell::InterfaceProvider);
+ std::unique_ptr<shell::InterfaceProvider> provider_b(
+ new shell::InterfaceProvider);
+
+ shell::mojom::InterfaceProviderPtr a_to_b;
+ shell::mojom::InterfaceProviderRequest a_to_b_request =
+ mojo::GetProxy(&a_to_b);
+ provider_a->Bind(std::move(a_to_b));
+ registry_b->Bind(std::move(a_to_b_request));
+
+ shell::mojom::InterfaceProviderPtr b_to_a;
+ shell::mojom::InterfaceProviderRequest b_to_a_request =
+ mojo::GetProxy(&b_to_a);
+ provider_b->Bind(std::move(b_to_a));
+ registry_a->Bind(std::move(b_to_a_request));
content::ServiceRegistryAndroid* wrapper_a =
- ServiceRegistryAndroid::Create(registry_a).release();
+ ServiceRegistryAndroid::Create(registry_a.get(),
+ provider_a.get()).release();
test_environment->wrappers.push_back(wrapper_a);
content::ServiceRegistryAndroid* wrapper_b =
- ServiceRegistryAndroid::Create(registry_b).release();
+ ServiceRegistryAndroid::Create(registry_b.get(),
+ provider_b.get()).release();
test_environment->wrappers.push_back(wrapper_b);
+ test_environment->registries.push_back(std::move(registry_a));
+ test_environment->providers.push_back(std::move(provider_a));
+ test_environment->registries.push_back(std::move(registry_b));
+ test_environment->providers.push_back(std::move(provider_b));
+
return Java_ShellMojoTestUtils_makePair(env, wrapper_a->GetObj().obj(),
wrapper_b->GetObj().obj());
}

Powered by Google App Engine
This is Rietveld 408576698