Loading tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java +30 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -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 + Loading Loading
tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java +30 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -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 + Loading