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

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

Issue 2795913003: [Merge m58] android: Limit bindToCaller check to webview (Closed)
Patch Set: remove final from chrome Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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.ComponentName; 7 import android.content.ComponentName;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.ServiceConnection; 10 import android.content.ServiceConnection;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 assertNotNull(replyHandler.mMessage); 380 assertNotNull(replyHandler.mMessage);
381 assertEquals(ChildProcessLauncherTestHelperService.MSG_BIND_SERVICE_REPL Y, 381 assertEquals(ChildProcessLauncherTestHelperService.MSG_BIND_SERVICE_REPL Y,
382 replyHandler.mMessage.what); 382 replyHandler.mMessage.what);
383 assertEquals("Connection slot from helper service is not 0", 0, replyHan dler.mMessage.arg2); 383 assertEquals("Connection slot from helper service is not 0", 0, replyHan dler.mMessage.arg2);
384 384
385 final int helperConnPid = replyHandler.mMessage.arg1; 385 final int helperConnPid = replyHandler.mMessage.arg1;
386 assertTrue(helperConnPid > 0); 386 assertTrue(helperConnPid > 0);
387 387
388 // Launch a service from this process. Since slot 0 is already bound by the Helper, it 388 // Launch a service from this process. Since slot 0 is already bound by the Helper, it
389 // will fail to start and the ChildProcessLauncher will retry. 389 // will fail to start and the ChildProcessLauncher will retry.
390 final ChildProcessConnection conn = ChildProcessLauncher.startForTesting (context, 390 final ChildProcessCreationParams creationParams = new ChildProcessCreati onParams(
391 sProcessWaitArguments, new FileDescriptorInfo[0], 391 context.getPackageName(), false /* isExternalService */,
392 getDefaultChildProcessCreationParams(context.getPackageName())); 392 LibraryProcessType.PROCESS_CHILD, true /* bindToCallerCheck */);
393 final ChildProcessConnection conn = ChildProcessLauncher.startForTesting (
394 context, sProcessWaitArguments, new FileDescriptorInfo[0], creat ionParams);
393 395
394 CriteriaHelper.pollInstrumentationThread( 396 CriteriaHelper.pollInstrumentationThread(
395 new Criteria("Failed waiting for instrumentation-bound service") { 397 new Criteria("Failed waiting for instrumentation-bound service") {
396 @Override 398 @Override
397 public boolean isSatisfied() { 399 public boolean isSatisfied() {
398 return conn.getService() != null; 400 return conn.getService() != null;
399 } 401 }
400 }); 402 });
401 403
402 assertEquals(0, conn.getServiceNumber()); 404 assertEquals(0, conn.getServiceNumber());
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 * Returns the number of Chrome's sandboxed connections. 527 * Returns the number of Chrome's sandboxed connections.
526 */ 528 */
527 private int allocatedChromeSandboxedConnectionsCount() { 529 private int allocatedChromeSandboxedConnectionsCount() {
528 Context context = getInstrumentation().getTargetContext(); 530 Context context = getInstrumentation().getTargetContext();
529 return ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting ( 531 return ChildProcessLauncher.allocatedSandboxedConnectionsCountForTesting (
530 context, context.getPackageName()); 532 context, context.getPackageName());
531 } 533 }
532 534
533 private ChildProcessCreationParams getDefaultChildProcessCreationParams(Stri ng packageName) { 535 private ChildProcessCreationParams getDefaultChildProcessCreationParams(Stri ng packageName) {
534 return new ChildProcessCreationParams(packageName, false /* isExternalSe rvice */, 536 return new ChildProcessCreationParams(packageName, false /* isExternalSe rvice */,
535 LibraryProcessType.PROCESS_CHILD); 537 LibraryProcessType.PROCESS_CHILD, false /* bindToCallerCheck */) ;
536 } 538 }
537 539
538 private void triggerConnectionSetup(ChildProcessConnectionImpl connection) { 540 private void triggerConnectionSetup(ChildProcessConnectionImpl connection) {
539 ChildProcessLauncher.triggerConnectionSetup(connection, sProcessWaitArgu ments, 1, 541 ChildProcessLauncher.triggerConnectionSetup(connection, sProcessWaitArgu ments, 1,
540 new FileDescriptorInfo[0], ChildProcessLauncher.CALLBACK_FOR_REN DERER_PROCESS, 0); 542 new FileDescriptorInfo[0], ChildProcessLauncher.CALLBACK_FOR_REN DERER_PROCESS, 0);
541 } 543 }
542 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698