From 8beab57254f00cb0cb15437594a9ec00f0ce7b4b Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 28 Jan 2016 17:43:56 -0800 Subject: [PATCH] [Android WebView] Do not terminate WebView when second browser is started Still detect the situation when the app is creating WebView from two processes sharing the same data dir, but do not throw a RuntimeError, only print a warning. BUG=558377,582146 Review URL: https://codereview.chromium.org/1641383002 Cr-Commit-Position: refs/heads/master@{#372231} (cherry picked from commit d881bd2507c934240decdcbf2a5002716fe5b308) Review URL: https://codereview.chromium.org/1650433003 . Cr-Commit-Position: refs/branch-heads/2623@{#185} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907} --- .../android_webview/AwBrowserProcess.java | 5 ++--- .../test/AwSecondBrowserProcessTest.java | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java index e7a6389dc4fd5..4b3f4c7b00895 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java +++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java @@ -104,9 +104,8 @@ private static void tryObtainingDataDirLockOrDie(Context context) { Log.w(TAG, "Failed to create lock file " + lockFile, e); } if (!success) { - throw new RuntimeException( - "Could not obtain an exclusive lock on the data dir. The app may have " - + "another WebView opened in a separate process"); + Log.w(TAG, "The app may have another WebView opened in a separate process. " + + "This is not recommended and may stop working in future versions."); } } } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java index 25f951fdfb959..dcf4e7c5464ed 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java @@ -13,10 +13,9 @@ import android.os.Parcel; import android.os.Process; import android.os.RemoteException; -import android.test.suitebuilder.annotation.LargeTest; import org.chromium.android_webview.AwBrowserProcess; -import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.DisabledTest; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; @@ -42,15 +41,24 @@ protected void tearDown() throws Exception { super.tearDown(); } - @LargeTest - @Feature({"AndroidWebView"}) + /* + * @LargeTest + * @Feature({"AndroidWebView"}) + * See crbug.com/582146. We can't test that creating second browser + * process succeeds either, because in debug it will crash due to an assert + * in the SQL DB code. + */ + @DisabledTest public void testCreatingSecondBrowserProcessFails() throws Throwable { startSecondBrowserProcess(); assertFalse(tryStartingBrowserProcess()); } - @LargeTest - @Feature({"AndroidWebView"}) + /* + * @LargeTest + * @Feature({"AndroidWebView"}) + */ + @DisabledTest public void testLockCleanupOnProcessShutdown() throws Throwable { startSecondBrowserProcess(); assertFalse(tryStartingBrowserProcess());