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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java

Issue 1579653003: Add some temporary logging to AwContentsGarbageCollectionTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | android_webview/native/aw_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java
index 501ce011a1dd9a30dd6b1e8c5021fe6abcbf1d06..8d6da4c96083d40bf93a6ea521428e9820ca97e6 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java
@@ -12,11 +12,13 @@ import android.test.suitebuilder.annotation.SmallTest;
import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
import org.chromium.android_webview.AwContents;
+import org.chromium.base.Log;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
+import java.util.Map;
import java.util.concurrent.Callable;
/**
@@ -26,6 +28,8 @@ import java.util.concurrent.Callable;
* See crbug.com/544098 for why @DisableHardwareAccelerationForTest is needed.
*/
public class AwContentsGarbageCollectionTest extends AwTestBase {
+ private static final String TAG = "AwGcTest";
+
// The system retains a strong ref to the last focused view (in InputMethodManager)
// so allow for 1 'leaked' instance.
private static final int MAX_IDLE_INSTANCES = 1;
@@ -86,6 +90,7 @@ public class AwContentsGarbageCollectionTest extends AwTestBase {
@SmallTest
@Feature({"AndroidWebView"})
public void testCreateAndGcOneTime() throws Throwable {
+ Log.d(TAG, "testCreateAndGcOneTime start");
gcAndCheckAllAwContentsDestroyed();
TestAwContentsClient client = new TestAwContentsClient();
@@ -94,10 +99,13 @@ public class AwContentsGarbageCollectionTest extends AwTestBase {
containerViews[i] = createAwTestContainerViewOnMainSync(client);
loadUrlAsync(containerViews[i].getAwContents(), "about:blank");
}
+ Log.d(TAG, "testCreateAndGcOneTime create views done");
containerViews = null;
removeAllViews();
+ Log.d(TAG, "testCreateAndGcOneTime remove views done");
gcAndCheckAllAwContentsDestroyed();
+ Log.d(TAG, "testCreateAndGcOneTime end");
}
@DisableHardwareAccelerationForTest
@@ -172,15 +180,31 @@ public class AwContentsGarbageCollectionTest extends AwTestBase {
}
private void removeAllViews() throws Throwable {
+ Log.d(TAG, "removeAllViews instrumentation thread");
+ dumpAllThreadStacks();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
+ Log.d(TAG, "removeAllViews UI thread");
getActivity().removeAllViews();
}
});
+ Log.d(TAG, "removeAllViews instrumentation thread done");
+ }
+
+ private void dumpAllThreadStacks() {
+ Log.d(TAG, "_________________________");
+ for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) {
+ Log.d(TAG, "Thread name: " + entry.getKey().getName());
+ for (StackTraceElement stack : entry.getValue()) {
+ Log.d(TAG, " " + stack);
+ }
+ }
+ Log.d(TAG, "_________________________");
}
private void gcAndCheckAllAwContentsDestroyed() throws InterruptedException {
+ Log.d(TAG, "Cause GC");
Runtime.getRuntime().gc();
Criteria criteria = new Criteria() {
@@ -191,6 +215,7 @@ public class AwContentsGarbageCollectionTest extends AwTestBase {
@Override
public Boolean call() {
int count = AwContents.getNativeInstanceCount();
+ Log.d(TAG, "NativeInstanceCount = " + count);
return count <= MAX_IDLE_INSTANCES;
}
});
@@ -210,6 +235,7 @@ public class AwContentsGarbageCollectionTest extends AwTestBase {
CriteriaHelper.pollForCriteria(criteria, timeoutBetweenGcMs, CHECK_INTERVAL);
break;
} catch (AssertionError e) {
+ Log.d(TAG, "Cause GC " + i);
Runtime.getRuntime().gc();
}
}
« no previous file with comments | « no previous file | android_webview/native/aw_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698