OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.RemoteException; | 8 import android.os.RemoteException; |
9 import android.test.InstrumentationTestCase; | 9 import android.test.InstrumentationTestCase; |
10 import android.test.suitebuilder.annotation.MediumTest; | 10 import android.test.suitebuilder.annotation.MediumTest; |
(...skipping 15 matching lines...) Expand all Loading... |
26 public class ChildProcessLauncherTest extends InstrumentationTestCase { | 26 public class ChildProcessLauncherTest extends InstrumentationTestCase { |
27 // Pseudo command line arguments to instruct the child process to wait until
being killed. | 27 // Pseudo command line arguments to instruct the child process to wait until
being killed. |
28 // Allowing the process to continue would lead to a crash when attempting to
initialize IPC | 28 // Allowing the process to continue would lead to a crash when attempting to
initialize IPC |
29 // channels that are not being set up in this test. | 29 // channels that are not being set up in this test. |
30 private static final String[] sProcessWaitArguments = { | 30 private static final String[] sProcessWaitArguments = { |
31 "_", "--" + BaseSwitches.RENDERER_WAIT_FOR_JAVA_DEBUGGER }; | 31 "_", "--" + BaseSwitches.RENDERER_WAIT_FOR_JAVA_DEBUGGER }; |
32 private static final String EXTERNAL_APK_PACKAGE_NAME = "org.chromium.extern
al.apk"; | 32 private static final String EXTERNAL_APK_PACKAGE_NAME = "org.chromium.extern
al.apk"; |
33 private static final String DEFAULT_SANDBOXED_PROCESS_SERVICE = | 33 private static final String DEFAULT_SANDBOXED_PROCESS_SERVICE = |
34 "org.chromium.content.app.SandboxedProcessService"; | 34 "org.chromium.content.app.SandboxedProcessService"; |
35 | 35 |
| 36 @Override |
| 37 protected void setUp() throws Exception { |
| 38 super.setUp(); |
| 39 LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized(); |
| 40 } |
| 41 |
36 /** | 42 /** |
37 * Tests cleanup for a connection that fails to connect in the first place. | 43 * Tests cleanup for a connection that fails to connect in the first place. |
38 */ | 44 */ |
39 @MediumTest | 45 @MediumTest |
40 @Feature({"ProcessManagement"}) | 46 @Feature({"ProcessManagement"}) |
41 @CommandLineFlags.Add(ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR
_TESTING + "=4") | 47 @CommandLineFlags.Add(ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR
_TESTING + "=4") |
42 public void testServiceFailedToBind() throws InterruptedException, RemoteExc
eption { | 48 public void testServiceFailedToBind() throws InterruptedException, RemoteExc
eption { |
43 assertEquals(0, allocatedChromeSandboxedConnectionsCount()); | 49 assertEquals(0, allocatedChromeSandboxedConnectionsCount()); |
44 assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting())
; | 50 assertEquals(0, ChildProcessLauncher.connectedServicesCountForTesting())
; |
45 | 51 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 337 |
332 private ChildProcessCreationParams getDefaultChildProcessCreationParams(Stri
ng packageName) { | 338 private ChildProcessCreationParams getDefaultChildProcessCreationParams(Stri
ng packageName) { |
333 return new ChildProcessCreationParams(packageName, 0, | 339 return new ChildProcessCreationParams(packageName, 0, |
334 LibraryProcessType.PROCESS_CHILD); | 340 LibraryProcessType.PROCESS_CHILD); |
335 } | 341 } |
336 | 342 |
337 private void triggerConnectionSetup(ChildProcessConnectionImpl connection) { | 343 private void triggerConnectionSetup(ChildProcessConnectionImpl connection) { |
338 ChildProcessLauncher.triggerConnectionSetup(connection, sProcessWaitArgu
ments, 1, | 344 ChildProcessLauncher.triggerConnectionSetup(connection, sProcessWaitArgu
ments, 1, |
339 new FileDescriptorInfo[0], ChildProcessLauncher.CALLBACK_FOR_REN
DERER_PROCESS, 0); | 345 new FileDescriptorInfo[0], ChildProcessLauncher.CALLBACK_FOR_REN
DERER_PROCESS, 0); |
340 } | 346 } |
341 | |
342 @Override | |
343 protected void setUp() throws Exception { | |
344 super.setUp(); | |
345 LibraryLoader.get(LibraryProcessType.PROCESS_CHILD) | |
346 .ensureInitialized(getInstrumentation().getTargetContext()); | |
347 } | |
348 } | 347 } |
OLD | NEW |