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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java

Issue 2772343003: Android: Remove GetApplicationContext part 1 (Closed)
Patch Set: rebase 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.support.test.filters.MediumTest; 7 import android.support.test.filters.MediumTest;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
9 9
10 import org.chromium.base.BuildInfo; 10 import org.chromium.base.BuildInfo;
(...skipping 24 matching lines...) Expand all
35 @MediumTest 35 @MediumTest
36 @DisableIf.Build(sdk_is_greater_than = 22, message = "crbug.com/517611") 36 @DisableIf.Build(sdk_is_greater_than = 22, message = "crbug.com/517611")
37 @Feature({"Browser", "Security"}) 37 @Feature({"Browser", "Security"})
38 @RetryOnFailure 38 @RetryOnFailure
39 public void testProcessIsolationForRenderers() throws InterruptedException { 39 public void testProcessIsolationForRenderers() throws InterruptedException {
40 int tabsCount = getActivity().getCurrentTabModel().getCount(); 40 int tabsCount = getActivity().getCurrentTabModel().getCount();
41 // The ActivityManager can be used to retrieve the current processes, bu t the reported UID 41 // The ActivityManager can be used to retrieve the current processes, bu t the reported UID
42 // in the RunningAppProcessInfo for isolated processes is the same as th e parent process 42 // in the RunningAppProcessInfo for isolated processes is the same as th e parent process
43 // (see b/7724486, closed as "Working as intended"). 43 // (see b/7724486, closed as "Working as intended").
44 // So we have to resort to parsing the ps output. 44 // So we have to resort to parsing the ps output.
45 String packageName = BuildInfo.getPackageName(getInstrumentation().getTa rgetContext()); 45 String packageName = BuildInfo.getPackageName();
46 assertFalse("Failed to retrieve package name for current version of Chro me.", 46 assertFalse("Failed to retrieve package name for current version of Chro me.",
47 TextUtils.isEmpty(packageName)); 47 TextUtils.isEmpty(packageName));
48 48
49 ArrayList<String> uids = new ArrayList<String>(); 49 ArrayList<String> uids = new ArrayList<String>();
50 BufferedReader reader = null; 50 BufferedReader reader = null;
51 boolean hasBrowserProcess = false; 51 boolean hasBrowserProcess = false;
52 int rendererProcessesCount = 0; 52 int rendererProcessesCount = 0;
53 StringBuilder sb = new StringBuilder(); 53 StringBuilder sb = new StringBuilder();
54 try { 54 try {
55 Process psProcess = Runtime.getRuntime().exec("ps"); 55 Process psProcess = Runtime.getRuntime().exec("ps");
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 assertEquals("Found at least two processes with the same UID in ps outpu t: \n" 113 assertEquals("Found at least two processes with the same UID in ps outpu t: \n"
114 + sb.toString(), 114 + sb.toString(),
115 uids.size(), new HashSet<String>(uids).size()); 115 uids.size(), new HashSet<String>(uids).size());
116 } 116 }
117 117
118 @Override 118 @Override
119 public void startMainActivity() throws InterruptedException { 119 public void startMainActivity() throws InterruptedException {
120 startMainActivityFromLauncher(); 120 startMainActivityFromLauncher();
121 } 121 }
122 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698