From 5f37cc4308438bcac45d06d07d77a56911620046 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 13 Oct 2010 18:44:31 +0100 Subject: Implement LayoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey') This is required for tests that test PageCache behaviour, eg - fast/dom/DeviceMotion/no-page-cache.html - fast/dom/DeviceOrientation/no-page-cache.html - fast/dom/Geolocation/no-page-cache.html Change-Id: Ie5862f6c86718142c949be81a85358ca6fac628a --- .../src/com/android/dumprendertree/TestShellActivity.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/DumpRenderTree') diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index 19815fd..643dbf5 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -66,7 +66,9 @@ public class TestShellActivity extends Activity implements LayoutTestController static enum DumpDataType {DUMP_AS_TEXT, EXT_REPR, NO_OP} // String constants for use with layoutTestController.overridePreferences - private final String WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED = "WebKitOfflineWebApplicationCacheEnabled"; + private final String WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED = + "WebKitOfflineWebApplicationCacheEnabled"; + private final String WEBKIT_USES_PAGE_CACHE_PREFERENCE_KEY = "WebKitUsesPageCachePreferenceKey"; public class AsyncHandler extends Handler { @Override @@ -524,8 +526,14 @@ public class TestShellActivity extends Activity implements LayoutTestController // called the layoutTestController method. Currently, we just use the // WebView for the main frame. EventSender suffers from the same // problem. - if (key.equals(WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED)) { + if (WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED.equals(key)) { mWebView.getSettings().setAppCacheEnabled(value); + } else if (WEBKIT_USES_PAGE_CACHE_PREFERENCE_KEY.equals(key)) { + // Cache the maximum possible number of pages. + mWebView.getSettings().setPageCacheCapacity(Integer.MAX_VALUE); + } else { + Log.w(LOGTAG, "LayoutTestController.overridePreference(): " + + "Unsupported preference '" + key + "'"); } } @@ -879,6 +887,7 @@ public class TestShellActivity extends Activity implements LayoutTestController settings.setDomStorageEnabled(true); settings.setWorkersEnabled(false); settings.setXSSAuditorEnabled(false); + settings.setPageCacheCapacity(0); } private WebView mWebView; -- cgit v1.1