Commit 19dcc411 authored by Paul Miller's avatar Paul Miller Committed by Commit Bot

WebView instrumentation test shell: Use try with StrictMode

BUG=628650

Change-Id: Ia78bfe6ad2d12362cb85bcc4580d907fe1ed6b47
Reviewed-on: https://chromium-review.googlesource.com/1105181Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568202}
parent 821155c3
...@@ -7,7 +7,6 @@ package org.chromium.android_webview.test; ...@@ -7,7 +7,6 @@ package org.chromium.android_webview.test;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.StrictMode;
import android.view.View; import android.view.View;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -15,6 +14,7 @@ import android.widget.LinearLayout; ...@@ -15,6 +14,7 @@ import android.widget.LinearLayout;
import org.chromium.android_webview.AwBrowserProcess; import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.android_webview.shell.AwShellResourceProvider; import org.chromium.android_webview.shell.AwShellResourceProvider;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.StrictModeContext;
/** /**
* This is a lightweight activity for tests that only require WebView functionality. * This is a lightweight activity for tests that only require WebView functionality.
...@@ -31,9 +31,9 @@ public class AwTestRunnerActivity extends Activity { ...@@ -31,9 +31,9 @@ public class AwTestRunnerActivity extends Activity {
AwShellResourceProvider.registerResources(this); AwShellResourceProvider.registerResources(this);
ContextUtils.initApplicationContext(getApplicationContext()); ContextUtils.initApplicationContext(getApplicationContext());
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); try (StrictModeContext ctx = StrictModeContext.allowDiskReads()) {
AwBrowserProcess.loadLibrary(null); AwBrowserProcess.loadLibrary(null);
StrictMode.setThreadPolicy(oldPolicy); }
mLinearLayout = new LinearLayout(this); mLinearLayout = new LinearLayout(this);
mLinearLayout.setOrientation(LinearLayout.VERTICAL); mLinearLayout.setOrientation(LinearLayout.VERTICAL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment