use of android.webkit.WebViewClassic in project android_frameworks_base by ParanoidAndroid.
the class LayoutTestsExecutor method setupWebView.
private void setupWebView(WebView webView) {
webView.setWebViewClient(mWebViewClient);
webView.setWebChromeClient(mWebChromeClient);
/**
* Setting a touch interval of -1 effectively disables the optimisation in WebView
* that stops repeated touch events flooding WebCore. The Event Sender only sends a
* single event rather than a stream of events (like what would generally happen in
* a real use of touch events in a WebView) and so if the WebView drops the event,
* the test will fail as the test expects one callback for every touch it synthesizes.
*/
WebViewClassic webViewClassic = WebViewClassic.fromWebView(webView);
webViewClassic.setTouchInterval(-1);
webViewClassic.clearCache(true);
WebSettingsClassic webViewSettings = webViewClassic.getSettings();
webViewSettings.setAppCacheEnabled(true);
webViewSettings.setAppCachePath(getApplicationContext().getCacheDir().getPath());
// Use of larger values causes unexplained AppCache database corruption.
// TODO: Investigate what's really going on here.
webViewSettings.setAppCacheMaxSize(100 * 1024 * 1024);
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webViewSettings.setSupportMultipleWindows(true);
webViewSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
webViewSettings.setDatabaseEnabled(true);
webViewSettings.setDatabasePath(getDir("databases", 0).getAbsolutePath());
webViewSettings.setDomStorageEnabled(true);
webViewSettings.setWorkersEnabled(false);
webViewSettings.setXSSAuditorEnabled(false);
webViewSettings.setPageCacheCapacity(0);
// This is asynchronous, but it gets processed by WebCore before it starts loading pages.
WebViewClassic.fromWebView(mCurrentWebView).setUseMockGeolocation();
WebViewClassic.fromWebView(mCurrentWebView).setUseMockDeviceOrientation();
// Must do this after setting the AppCache path.
WebStorage.getInstance().deleteAllData();
}
Aggregations