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

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

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

Powered by Google App Engine
This is Rietveld 408576698