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

Unified Diff: content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java

Issue 2855323003: Removed the service number member from BaseChildProcessConnection. (Closed)
Patch Set: Minor clean-up Created 3 years, 7 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/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java
index 7884711d80e6fa5e8f52cba0252bce8ceef59956..807e77ce0e7f1895e542a436923d365d26ce2d75 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestUtils.java
@@ -79,13 +79,33 @@ public final class ChildProcessLauncherTestUtils {
});
}
+ // Retrieves the service number of the passed in connection from its service name, or -1 if the
+ // service number could not be determined.
+ public static int getConnectionServiceNumber(final BaseChildProcessConnection connection) {
+ String serviceName = getConnectionServiceName(connection);
+ // The service name ends up with the service number.
+ StringBuilder numberString = new StringBuilder();
+ for (int i = serviceName.length() - 1; i >= 0; i--) {
+ char c = serviceName.charAt(i);
+ if (!Character.isDigit(c)) {
+ break;
+ }
+ numberString.append(c);
+ }
+ try {
+ return Integer.decode(numberString.toString());
+ } catch (NumberFormatException nfe) {
+ return -1;
+ }
+ }
+
// Retrieves the service number of the passed in connection on the launcher thread as to not
// assert.
- public static int getConnectionServiceNumber(final BaseChildProcessConnection connection) {
- return runOnLauncherAndGetResult(new Callable<Integer>() {
+ public static String getConnectionServiceName(final BaseChildProcessConnection connection) {
+ return runOnLauncherAndGetResult(new Callable<String>() {
@Override
- public Integer call() {
- return connection.getServiceNumber();
+ public String call() {
+ return connection.getServiceName().getClassName();
}
});
}
« no previous file with comments | « content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698