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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java

Issue 441363003: Android: allow to kill a child process in instrumentation testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
index 2a4bcd8eb684dde6e498737c202f5dbfd96292b7..614d4b006200fd16c1edc52a039985e9e525dea0 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
@@ -6,6 +6,7 @@ package org.chromium.content.browser;
import android.content.Context;
import android.graphics.SurfaceTexture;
+import android.os.RemoteException;
import android.util.Log;
import android.util.Pair;
import android.view.Surface;
@@ -531,6 +532,23 @@ public class ChildProcessLauncher {
return sServiceMap.size();
}
+ /**
+ * Kills the child process for testing.
+ * @return true iff the process was killed as expected
+ */
+ @VisibleForTesting
+ public static boolean crashProcessForTesting(int pid) {
+ if (sServiceMap.get(pid) == null) return false;
+
+ try {
+ ((ChildProcessConnectionImpl) sServiceMap.get(pid)).crashServiceForTesting();
+ } catch (RemoteException ex) {
+ return false;
+ }
+
+ return true;
+ }
+
private static native void nativeOnChildProcessStarted(long clientContext, int pid);
private static native void nativeEstablishSurfacePeer(
int pid, Surface surface, int primaryID, int secondaryID);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698