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

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

Issue 2766393004: Convert most of the rest of instrumentation tests in content (Closed)
Patch Set: Created 3 years, 9 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/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
index 2ea5697362be6aa80ff1a41086c417c0baf88943..fda1764d0359994ec8e3d6795d70bc344b683c2f 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
@@ -14,15 +14,22 @@ import android.os.Looper;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
-import android.test.InstrumentationTestCase;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.chromium.base.BaseSwitches;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.LibraryProcessType;
+import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.base.process_launcher.ChildProcessCreationParams;
import org.chromium.base.process_launcher.FileDescriptorInfo;
-import org.chromium.base.test.util.CommandLineFlags;
+import org.chromium.base.test.BaseJUnit4ClassRunner;
+import org.chromium.base.test.util.CommandLineTestRule;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -34,7 +41,8 @@ import java.util.concurrent.Callable;
/**
* Instrumentation tests for ChildProcessLauncher.
*/
-public class ChildProcessLauncherTest extends InstrumentationTestCase {
+@RunWith(BaseJUnit4ClassRunner.class)
+public class ChildProcessLauncherTest {
// Pseudo command line arguments to instruct the child process to wait until being killed.
// Allowing the process to continue would lead to a crash when attempting to initialize IPC
// channels that are not being set up in this test.
@@ -44,26 +52,27 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
private static final String DEFAULT_SANDBOXED_PROCESS_SERVICE =
"org.chromium.content.app.SandboxedProcessService";
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
boliu 2017/03/23 18:04:08 why not use a @Before method?
the real yoland 2017/03/23 18:39:56 Because for testServiceFailedToBind, mCommandLineT
boliu 2017/03/23 18:42:32 Does that mean we no longer have per-test command
the real yoland 2017/03/23 19:01:03 yes if we want per-test support, we need to use a
boliu 2017/03/23 19:02:51 If annotation still works, why do we have CommandL
the real yoland 2017/03/23 19:16:31 currently, annotation does not work. It would work
boliu 2017/03/23 20:08:56 Can we do that here then?
- }
+ @Rule
+ public CommandLineTestRule mCommandLineTestRule = new CommandLineTestRule(false);
/**
* Tests cleanup for a connection that fails to connect in the first place.
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- @CommandLineFlags.Add(ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING + "=4")
- public void testServiceFailedToBind() {
- assertEquals(0, allocatedChromeSandboxedConnectionsCount());
- assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting());
+ public void testServiceFailedToBind() throws Exception {
+ mCommandLineTestRule.setFlags(
+ ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING + "=4");
+ mCommandLineTestRule.setUp();
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ Assert.assertEquals(0, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting());
// Try to allocate a connection to service class in incorrect package. We can do that by
// using the instrumentation context (getContext()) instead of the app context
// (getTargetContext()).
- Context context = getInstrumentation().getContext();
+ Context context = InstrumentationRegistry.getInstrumentation().getContext();
ChildProcessLauncher.allocateBoundConnectionForTesting(
context, getDefaultChildProcessCreationParams(context.getPackageName()));
@@ -85,23 +94,26 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
/**
* Tests cleanup for a connection that terminates before setup.
+ * @throws ProcessInitException
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- public void testServiceCrashedBeforeSetup() throws RemoteException {
- assertEquals(0, allocatedChromeSandboxedConnectionsCount());
- assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting());
+ public void testServiceCrashedBeforeSetup() throws RemoteException, ProcessInitException {
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ Assert.assertEquals(0, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting());
// Start and connect to a new service.
final ChildProcessConnectionImpl connection = startConnection();
- assertEquals(1, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(1, allocatedChromeSandboxedConnectionsCount());
// Verify that the service is not yet set up.
- assertEquals(0, connection.getPid());
- assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting());
+ Assert.assertEquals(0, connection.getPid());
+ Assert.assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting());
// Crash the service.
- assertTrue(connection.crashServiceForTesting());
+ Assert.assertTrue(connection.crashServiceForTesting());
// Verify that the connection gets cleaned-up.
CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable<Integer>() {
@@ -121,15 +133,18 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
/**
* Tests cleanup for a connection that terminates after setup.
+ * @throws ProcessInitException
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- public void testServiceCrashedAfterSetup() throws RemoteException {
- assertEquals(0, allocatedChromeSandboxedConnectionsCount());
+ public void testServiceCrashedAfterSetup() throws RemoteException, ProcessInitException {
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ Assert.assertEquals(0, allocatedChromeSandboxedConnectionsCount());
// Start and connect to a new service.
final ChildProcessConnectionImpl connection = startConnection();
- assertEquals(1, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(1, allocatedChromeSandboxedConnectionsCount());
// Initiate the connection setup.
triggerConnectionSetup(connection);
@@ -151,7 +166,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
});
// Crash the service.
- assertTrue(connection.crashServiceForTesting());
+ Assert.assertTrue(connection.crashServiceForTesting());
// Verify that the connection gets cleaned-up.
CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable<Integer>() {
@@ -169,21 +184,24 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
}));
// Verify that the connection pid remains set after termination.
- assertTrue(connection.getPid() != 0);
+ Assert.assertTrue(connection.getPid() != 0);
}
/**
* Tests spawning a pending process from queue.
+ * @throws ProcessInitException
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- public void testPendingSpawnQueue() throws RemoteException {
- final Context appContext = getInstrumentation().getTargetContext();
- assertEquals(0, allocatedChromeSandboxedConnectionsCount());
+ public void testPendingSpawnQueue() throws RemoteException, ProcessInitException {
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ final Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ Assert.assertEquals(0, allocatedChromeSandboxedConnectionsCount());
// Start and connect to a new service.
final ChildProcessConnectionImpl connection = startConnection();
- assertEquals(1, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(1, allocatedChromeSandboxedConnectionsCount());
// Queue up a new spawn request. There is no way to kill the pending connection, leak it
// until the browser restart.
@@ -191,8 +209,9 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
final boolean inSandbox = true;
ChildProcessLauncher.enqueuePendingSpawnForTesting(appContext, sProcessWaitArguments,
getDefaultChildProcessCreationParams(packageName), inSandbox);
- assertEquals(1, ChildProcessLauncher.pendingSpawnsCountForTesting(appContext, packageName,
- inSandbox));
+ Assert.assertEquals(1,
+ ChildProcessLauncher.pendingSpawnsCountForTesting(
+ appContext, packageName, inSandbox));
// Initiate the connection setup.
triggerConnectionSetup(connection);
@@ -215,7 +234,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
});
// Crash the service.
- assertTrue(connection.crashServiceForTesting());
+ Assert.assertTrue(connection.crashServiceForTesting());
// Verify that a new service is started for the pending spawn.
CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable<Integer>() {
@@ -246,17 +265,24 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
/**
* Tests service number of connections for external APKs and regular tabs are assigned properly,
* i.e. from different ChildConnectionAllocators.
+ * @throws ProcessInitException
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- @CommandLineFlags.Add({ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING + "=4",
- ChildProcessLauncher.SWITCH_SANDBOXED_SERVICES_NAME_FOR_TESTING + "="
- + DEFAULT_SANDBOXED_PROCESS_SERVICE})
- public void testServiceNumberAllocation() {
- Context appContext = getInstrumentation().getTargetContext();
- assertEquals(0, ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
- appContext, EXTERNAL_APK_PACKAGE_NAME));
- assertEquals(0, allocatedChromeSandboxedConnectionsCount());
+ public void testServiceNumberAllocation() throws ProcessInitException {
+ mCommandLineTestRule.setFlags(
+ ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING + "=4",
+ ChildProcessLauncher.SWITCH_SANDBOXED_SERVICES_NAME_FOR_TESTING + "="
+ + DEFAULT_SANDBOXED_PROCESS_SERVICE);
+
+ mCommandLineTestRule.setUp();
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ Assert.assertEquals(0,
+ ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
+ appContext, EXTERNAL_APK_PACKAGE_NAME));
+ Assert.assertEquals(0, allocatedChromeSandboxedConnectionsCount());
// Start and connect to a new service of an external APK.
ChildProcessConnectionImpl externalApkConnection =
@@ -266,45 +292,52 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
// Verify that one connection is allocated for an external APK and a regular tab
// respectively.
- assertEquals(1, ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
- appContext, EXTERNAL_APK_PACKAGE_NAME));
- assertEquals(1, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(1,
+ ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
+ appContext, EXTERNAL_APK_PACKAGE_NAME));
+ Assert.assertEquals(1, allocatedChromeSandboxedConnectionsCount());
// Verify that connections allocated for an external APK and the regular tab are from
// different ChildConnectionAllocators, since both ChildConnectionAllocators start
// allocating connections from number 0.
- assertEquals(0, externalApkConnection.getServiceNumber());
- assertEquals(0, tabConnection.getServiceNumber());
+ Assert.assertEquals(0, externalApkConnection.getServiceNumber());
+ Assert.assertEquals(0, tabConnection.getServiceNumber());
}
/**
* Tests that after reaching the maximum allowed connections for an external APK, we can't
* allocate a new connection to the APK, but we can still allocate a connection for a regular
* tab.
+ * @throws ProcessInitException
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- @CommandLineFlags.Add({ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING + "=1",
- ChildProcessLauncher.SWITCH_SANDBOXED_SERVICES_NAME_FOR_TESTING + "="
- + DEFAULT_SANDBOXED_PROCESS_SERVICE})
- public void testExceedMaximumConnectionNumber() {
- Context appContext = getInstrumentation().getTargetContext();
- assertEquals(0, ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
- appContext, EXTERNAL_APK_PACKAGE_NAME));
+ public void testExceedMaximumConnectionNumber() throws ProcessInitException {
+ mCommandLineTestRule.setFlags(
+ ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING + "=1",
+ ChildProcessLauncher.SWITCH_SANDBOXED_SERVICES_NAME_FOR_TESTING + "="
+ + DEFAULT_SANDBOXED_PROCESS_SERVICE);
+ mCommandLineTestRule.setUp();
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ Assert.assertEquals(0,
+ ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
+ appContext, EXTERNAL_APK_PACKAGE_NAME));
// Setup a connection for an external APK to reach the maximum allowed connection number.
ChildProcessConnectionImpl externalApkConnection =
allocateConnection(EXTERNAL_APK_PACKAGE_NAME);
- assertNotNull(externalApkConnection);
+ Assert.assertNotNull(externalApkConnection);
// Verify that there isn't any connection available for the external APK.
ChildProcessConnectionImpl exceedNumberExternalApkConnection =
allocateConnection(EXTERNAL_APK_PACKAGE_NAME);
- assertNull(exceedNumberExternalApkConnection);
+ Assert.assertNull(exceedNumberExternalApkConnection);
// Verify that we can still allocate connection for a regular tab.
ChildProcessConnectionImpl tabConnection = allocateConnection(appContext.getPackageName());
- assertNotNull(tabConnection);
+ Assert.assertNotNull(tabConnection);
}
/**
@@ -313,11 +346,15 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
* ContentShell.apk as a separate android:process to bind the first (slot 0) service. The
* instrumentation test then tries to bind the same slot, which fails, so the
* ChildProcessLauncher retries on a new connection.
+ * @throws ProcessInitException
*/
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- public void testBindServiceFromMultipleProcesses() throws RemoteException {
- final Context context = getInstrumentation().getTargetContext();
+ public void testBindServiceFromMultipleProcesses()
+ throws RemoteException, ProcessInitException {
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
// Start the Helper service.
class HelperConnection implements ServiceConnection {
@@ -336,7 +373,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
Intent intent = new Intent();
intent.setComponent(new ComponentName(context.getPackageName(),
context.getPackageName() + ".ChildProcessLauncherTestHelperService"));
- assertTrue(context.bindService(intent, serviceConn, Context.BIND_AUTO_CREATE));
+ Assert.assertTrue(context.bindService(intent, serviceConn, Context.BIND_AUTO_CREATE));
// Wait for the Helper service to connect.
CriteriaHelper.pollInstrumentationThread(
@@ -347,7 +384,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
}
});
- assertNotNull(serviceConn.mMessenger);
+ Assert.assertNotNull(serviceConn.mMessenger);
class ReplyHandler implements Handler.Callback {
Message mMessage;
@@ -378,13 +415,14 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
});
// Verify that the Helper was able to launch the sandboxed service.
- assertNotNull(replyHandler.mMessage);
- assertEquals(ChildProcessLauncherTestHelperService.MSG_BIND_SERVICE_REPLY,
+ Assert.assertNotNull(replyHandler.mMessage);
+ Assert.assertEquals(ChildProcessLauncherTestHelperService.MSG_BIND_SERVICE_REPLY,
replyHandler.mMessage.what);
- assertEquals("Connection slot from helper service is not 0", 0, replyHandler.mMessage.arg2);
+ Assert.assertEquals(
+ "Connection slot from helper service is not 0", 0, replyHandler.mMessage.arg2);
final int helperConnPid = replyHandler.mMessage.arg1;
- assertTrue(helperConnPid > 0);
+ Assert.assertTrue(helperConnPid > 0);
// Launch a service from this process. Since slot 0 is already bound by the Helper, it
// will fail to start and the ChildProcessLauncher will retry.
@@ -400,7 +438,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
}
});
- assertEquals(0, conn.getServiceNumber());
+ Assert.assertEquals(0, conn.getServiceNumber());
final ChildProcessConnection[] sandboxedConnections =
ChildProcessLauncher.getSandboxedConnectionArrayForTesting(
@@ -424,47 +462,52 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
for (int i = 0; i < sandboxedConnections.length; ++i) {
ChildProcessConnection sandboxedConn = sandboxedConnections[i];
if (i <= 1) {
- assertNotNull(sandboxedConn);
- assertNotNull(sandboxedConn.getService());
+ Assert.assertNotNull(sandboxedConn);
+ Assert.assertNotNull(sandboxedConn.getService());
} else {
- assertNull(sandboxedConn);
+ Assert.assertNull(sandboxedConn);
}
}
- assertTrue(conn == sandboxedConnections[0]);
+ Assert.assertTrue(conn == sandboxedConnections[0]);
final ChildProcessConnection retryConn = sandboxedConnections[1];
- assertFalse(conn == retryConn);
+ Assert.assertFalse(conn == retryConn);
- assertEquals(0, conn.getServiceNumber());
- assertEquals(0, conn.getPid());
- assertFalse(conn.getService().bindToCaller());
+ Assert.assertEquals(0, conn.getServiceNumber());
+ Assert.assertEquals(0, conn.getPid());
+ Assert.assertFalse(conn.getService().bindToCaller());
- assertEquals(1, retryConn.getServiceNumber());
- assertTrue(retryConn.getPid() > 0);
- assertTrue(retryConn.getPid() != helperConnPid);
- assertTrue(retryConn.getService().bindToCaller());
+ Assert.assertEquals(1, retryConn.getServiceNumber());
+ Assert.assertTrue(retryConn.getPid() > 0);
+ Assert.assertTrue(retryConn.getPid() != helperConnPid);
+ Assert.assertTrue(retryConn.getService().bindToCaller());
}
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- public void testWarmUp() {
- Context context = getInstrumentation().getTargetContext();
+ public void testWarmUp() throws ProcessInitException {
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
ChildProcessLauncher.warmUp(context); // Not on UI thread.
- assertEquals(1, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(1, allocatedChromeSandboxedConnectionsCount());
final ChildProcessConnection conn = ChildProcessLauncher.startForTesting(
context, new String[0], new FileDescriptorInfo[0], null);
- assertEquals(1, allocatedChromeSandboxedConnectionsCount()); // Used warmup connection.
+ Assert.assertEquals(
+ 1, allocatedChromeSandboxedConnectionsCount()); // Used warmup connection.
ChildProcessLauncher.stop(conn.getPid());
}
+ @Test
@MediumTest
@Feature({"ProcessManagement"})
- public void testCustomCreationParamDoesNotReuseWarmupConnection() {
+ public void testCustomCreationParamDoesNotReuseWarmupConnection() throws ProcessInitException {
+ LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized();
// Since warmUp only uses default params.
- Context context = getInstrumentation().getTargetContext();
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
// Check uses object identity, having the params match exactly is fine.
ChildProcessCreationParams.registerDefault(
getDefaultChildProcessCreationParams(context.getPackageName()));
@@ -472,21 +515,21 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
getDefaultChildProcessCreationParams(context.getPackageName()));
ChildProcessLauncher.warmUp(context); // Not on UI thread.
- assertEquals(1, allocatedChromeSandboxedConnectionsCount());
+ Assert.assertEquals(1, allocatedChromeSandboxedConnectionsCount());
startRendererProcess(context, paramId, new FileDescriptorInfo[0]);
- assertEquals(2, allocatedChromeSandboxedConnectionsCount()); // Warmup not used.
+ Assert.assertEquals(2, allocatedChromeSandboxedConnectionsCount()); // Warmup not used.
startRendererProcess(
context, ChildProcessCreationParams.DEFAULT_ID, new FileDescriptorInfo[0]);
- assertEquals(2, allocatedChromeSandboxedConnectionsCount()); // Warmup used.
+ Assert.assertEquals(2, allocatedChromeSandboxedConnectionsCount()); // Warmup used.
ChildProcessCreationParams.unregister(paramId);
}
private ChildProcessConnectionImpl startConnection() {
// Allocate a new connection.
- Context context = getInstrumentation().getTargetContext();
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
final ChildProcessConnectionImpl connection =
(ChildProcessConnectionImpl) ChildProcessLauncher.allocateBoundConnectionForTesting(
context, getDefaultChildProcessCreationParams(context.getPackageName()));
@@ -517,7 +560,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
*/
private ChildProcessConnectionImpl allocateConnection(String packageName) {
// Allocate a new connection.
- Context context = getInstrumentation().getTargetContext();
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
return (ChildProcessConnectionImpl) ChildProcessLauncher.allocateConnectionForTesting(
context, getDefaultChildProcessCreationParams(packageName));
}
@@ -526,7 +569,7 @@ public class ChildProcessLauncherTest extends InstrumentationTestCase {
* Returns the number of Chrome's sandboxed connections.
*/
private int allocatedChromeSandboxedConnectionsCount() {
- Context context = getInstrumentation().getTargetContext();
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
return ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting(
context, context.getPackageName());
}

Powered by Google App Engine
This is Rietveld 408576698