diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java | 4 | ||||
-rw-r--r-- | tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java | 30 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java index 7d57eb7..a82037e 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java @@ -79,6 +79,10 @@ public class LayoutTestController { mLayoutTestsExecutor.setGeolocationPermission(allow); } + public void overridePreference(String key, boolean value) { + mLayoutTestsExecutor.overridePreference(key, value); + } + public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) { Log.i(LOG_TAG, "setMockGeolocationPosition(): " + "latitude=" + latitude + " longitude=" + longitude + " accuracy=" + accuracy); diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java index 93bb6a0..c997911 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java @@ -507,6 +507,11 @@ public class LayoutTestsExecutor extends Activity { private static final int MSG_SET_CAN_OPEN_WINDOWS = 4; private static final int MSG_DUMP_DATABASE_CALLBACKS = 5; private static final int MSG_SET_GEOLOCATION_PERMISSION = 6; + private static final int MSG_OVERRIDE_PREFERENCE = 7; + + /** String constants for use with layoutTestController.overridePreference() */ + private final String WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED = + "WebKitOfflineWebApplicationCacheEnabled"; Handler mLayoutTestControllerHandler = new Handler() { @Override @@ -570,6 +575,22 @@ public class LayoutTestsExecutor extends Activity { } break; + case MSG_OVERRIDE_PREFERENCE: + /** + * TODO: We should look up the correct WebView for the frame which + * called the layoutTestController method. Currently, we just use the + * WebView for the main frame. EventSender suffers from the same + * problem. + */ + if (msg.getData().getString("key").equals( + WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED)) { + mCurrentWebView.getSettings().setAppCacheEnabled(msg.getData().getBoolean( + "value")); + } else { + Log.w(LOG_TAG, "MSG_OVERRIDE_PREFERENCE: unsupported preference!"); + } + break; + default: assert false : "msg.what=" + msg.what; break; @@ -626,6 +647,15 @@ public class LayoutTestsExecutor extends Activity { msg.sendToTarget(); } + public void overridePreference(String key, boolean value) { + Log.i(LOG_TAG, mCurrentTestRelativePath + ": overridePreference(" + key + ", " + value + + ") called"); + Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_OVERRIDE_PREFERENCE); + msg.getData().putString("key", key); + msg.getData().putBoolean("value", value); + msg.sendToTarget(); + } + public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { Log.i(LOG_TAG, mCurrentTestRelativePath + ": setMockDeviceOrientation(" + canProvideAlpha + |