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

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

Issue 2217013002: Remove the JNI-based InterfaceRegistry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@java-interface-registry-migration
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « content/shell/browser/shell_mojo_test_utils_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index a72683d2d1b4740e1d39b720d9a9cc77ce6234e7..0000000000000000000000000000000000000000
--- a/content/shell/browser/shell_mojo_test_utils_android.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/shell/browser/shell_mojo_test_utils_android.h"
-
-#include <utility>
-
-#include "base/location.h"
-#include "base/memory/scoped_vector.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "content/public/browser/android/interface_provider_android.h"
-#include "content/public/browser/android/interface_registry_android.h"
-#include "jni/ShellMojoTestUtils_jni.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
-
-using base::android::JavaParamRef;
-using base::android::ScopedJavaLocalRef;
-
-namespace {
-
-struct TestEnvironment {
- base::MessageLoop message_loop;
- std::vector<std::unique_ptr<shell::InterfaceRegistry>> registries;
- std::vector<std::unique_ptr<shell::InterfaceProvider>> providers;
- std::vector<std::unique_ptr<content::InterfaceRegistryAndroid>>
- registry_wrappers;
- std::vector<std::unique_ptr<content::InterfaceProviderAndroid>>
- provider_wrappers;
-};
-
-} // namespace
-
-namespace content {
-
-static jlong SetupTestEnvironment(JNIEnv* env,
- const JavaParamRef<jclass>& jcaller) {
- return reinterpret_cast<intptr_t>(new TestEnvironment());
-}
-
-static void TearDownTestEnvironment(JNIEnv* env,
- const JavaParamRef<jclass>& jcaller,
- jlong test_environment) {
- delete reinterpret_cast<TestEnvironment*>(test_environment);
-}
-
-static ScopedJavaLocalRef<jobject> CreateInterfaceRegistryAndProvider(
- JNIEnv* env,
- const JavaParamRef<jclass>& jcaller,
- jlong native_test_environment) {
- TestEnvironment* test_environment =
- reinterpret_cast<TestEnvironment*>(native_test_environment);
-
- std::unique_ptr<shell::InterfaceRegistry> registry(
- new shell::InterfaceRegistry);
- std::unique_ptr<shell::InterfaceProvider> provider(
- new shell::InterfaceProvider);
-
- shell::mojom::InterfaceProviderPtr provider_proxy;
- shell::mojom::InterfaceProviderRequest provider_request =
- mojo::GetProxy(&provider_proxy);
- provider->Bind(std::move(provider_proxy));
- registry->Bind(std::move(provider_request));
-
- std::unique_ptr<content::InterfaceRegistryAndroid> registry_android(
- InterfaceRegistryAndroid::Create(registry.get()));
- std::unique_ptr<content::InterfaceProviderAndroid> provider_android(
- InterfaceProviderAndroid::Create(provider.get()));
-
- ScopedJavaLocalRef<jobject> obj = Java_ShellMojoTestUtils_makePair(
- env, registry_android->GetObj(), provider_android->GetObj());
-
- test_environment->registry_wrappers.push_back(std::move(registry_android));
- test_environment->provider_wrappers.push_back(std::move(provider_android));
- test_environment->registries.push_back(std::move(registry));
- test_environment->providers.push_back(std::move(provider));
-
- return obj;
-}
-
-static void RunLoop(JNIEnv* env,
- const JavaParamRef<jclass>& jcaller,
- jlong timeout_ms) {
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
- base::TimeDelta::FromMilliseconds(timeout_ms));
- base::RunLoop run_loop;
- run_loop.Run();
-}
-
-bool RegisterShellMojoTestUtils(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-} // namespace content
« no previous file with comments | « content/shell/browser/shell_mojo_test_utils_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698