use of android.webkit.WebSettingsClassic 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();
}
use of android.webkit.WebSettingsClassic in project android_frameworks_base by ParanoidAndroid.
the class TestShellActivity method setDefaultWebSettings.
public void setDefaultWebSettings(WebView webview) {
WebSettingsClassic settings = WebViewClassic.fromWebView(webview).getSettings();
settings.setAppCacheEnabled(true);
settings.setAppCachePath(getApplicationContext().getCacheDir().getPath());
settings.setAppCacheMaxSize(Long.MAX_VALUE);
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setSupportMultipleWindows(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
settings.setDatabaseEnabled(true);
settings.setDatabasePath(getDir("databases", 0).getAbsolutePath());
settings.setDomStorageEnabled(true);
settings.setWorkersEnabled(false);
settings.setXSSAuditorEnabled(false);
settings.setPageCacheCapacity(0);
settings.setProperty("use_minimal_memory", "false");
settings.setAllowUniversalAccessFromFileURLs(true);
settings.setAllowFileAccessFromFileURLs(true);
}
use of android.webkit.WebSettingsClassic in project android_frameworks_base by ParanoidAndroid.
the class ProfiledWebView method startScrollTest.
/*
* Called once the page is loaded to start scrolling for evaluating tiles.
* If autoScrolling isn't set, stop must be called manually. Before
* scrolling, invalidate all content and redraw it, measuring time taken.
*/
public void startScrollTest(ProfileCallback callback, boolean autoScrolling) {
mCallback = callback;
mIsTesting = false;
mIsScrolling = false;
WebSettingsClassic settings = getWebViewClassic().getSettings();
settings.setProperty("tree_updates", "0");
if (autoScrolling) {
// after a while, force it to start even if the pages haven't swapped
new CountDownTimer(LOAD_STALL_MILLIS, LOAD_STALL_MILLIS) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
// invalidate all content, and kick off redraw
Log.d("ProfiledWebView", "kicking off test with callback registration, and tile discard...");
getWebViewClassic().discardAllTextures();
invalidate();
mIsScrolling = true;
mContentInvalMillis = System.currentTimeMillis();
}
}.start();
} else {
mIsTesting = true;
getWebViewClassic().tileProfilingStart();
}
}
use of android.webkit.WebSettingsClassic in project android_frameworks_base by ParanoidAndroid.
the class ProfiledWebView method setDoubleBuffering.
public void setDoubleBuffering(boolean useDoubleBuffering) {
WebSettingsClassic settings = getWebViewClassic().getSettings();
settings.setProperty("use_double_buffering", useDoubleBuffering ? "true" : "false");
}
use of android.webkit.WebSettingsClassic in project android_frameworks_base by ParanoidAndroid.
the class ProfiledWebView method init.
public void init(Context c) {
WebSettingsClassic settings = getWebViewClassic().getSettings();
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setEnableSmoothTransition(true);
settings.setBuiltInZoomControls(true);
settings.setLoadWithOverviewMode(true);
// prefetch tiles, as browser does
settings.setProperty("use_minimal_memory", "false");
addJavascriptInterface(new JavaScriptInterface(c), "Android");
mAnimationTime = 0;
mLoadTime = 0;
}
Aggregations