Loading tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java +16 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.dumprendertree2; import android.net.Uri; import android.util.Log; import android.webkit.MockGeolocation; import android.webkit.WebStorage; import java.io.File; Loading Loading @@ -73,4 +74,19 @@ public class LayoutTestController { WebStorage.getInstance().setQuotaForOrigin(Uri.fromFile(new File("")).toString(), quota); } public void setGeolocationPermission(boolean allow) { mLayoutTestsExecutor.setGeolocationPermission(allow); } public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) { Log.w(LOG_TAG + "::setMockGeolocationPosition", "latitude: " + latitude + " longitude: " + longitude + " accuracy: " + accuracy); MockGeolocation.getInstance().setPosition(latitude, longitude, accuracy); } public void setMockGeolocationError(int code, String message) { Log.w(LOG_TAG + "::setMockGeolocationError", "code: " + code + " message: " + message); MockGeolocation.getInstance().setError(code, message); } } No newline at end of file tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java +25 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.webkit.GeolocationPermissions.Callback; import android.webkit.WebStorage.QuotaUpdater; import java.io.File; Loading Loading @@ -104,6 +105,8 @@ public class LayoutTestsExecutor extends Activity { private LayoutTestController mLayoutTestController = new LayoutTestController(this); private boolean mCanOpenWindows; private boolean mDumpDatabaseCallbacks; private boolean mSetGeolocationPermissionCalled; private boolean mGeolocationPermission; private WakeLock mScreenDimLock; Loading Loading @@ -221,6 +224,13 @@ public class LayoutTestsExecutor extends Activity { resultMsg.sendToTarget(); return true; } @Override public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { if (mSetGeolocationPermissionCalled) { callback.invoke(origin, mGeolocationPermission, false); } } }; /** IMPLEMENTATION */ Loading Loading @@ -420,6 +430,7 @@ public class LayoutTestsExecutor extends Activity { private static final int MSG_DUMP_CHILD_FRAMES_AS_TEXT = 3; 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_PREMISSION = 6; Handler mLayoutTestControllerHandler = new Handler() { @Override Loading Loading @@ -468,6 +479,11 @@ public class LayoutTestsExecutor extends Activity { mDumpDatabaseCallbacks = true; break; case MSG_SET_GEOLOCATION_PREMISSION: mSetGeolocationPermissionCalled = true; mGeolocationPermission = msg.arg1 == 1; break; default: Log.w(LOG_TAG + "::handleMessage", "Message code does not exist: " + msg.what); break; Loading @@ -478,6 +494,8 @@ public class LayoutTestsExecutor extends Activity { private void resetLayoutTestController() { mCanOpenWindows = false; mDumpDatabaseCallbacks = false; mSetGeolocationPermissionCalled = false; mGeolocationPermission = false; } public void waitUntilDone() { Loading Loading @@ -513,4 +531,11 @@ public class LayoutTestsExecutor extends Activity { Log.w(LOG_TAG + "::dumpDatabaseCallbacks:", "called"); mLayoutTestControllerHandler.sendEmptyMessage(MSG_DUMP_DATABASE_CALLBACKS); } public void setGeolocationPermission(boolean allow) { Log.w(LOG_TAG + "::setGeolocationPermission", "called"); Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_SET_GEOLOCATION_PREMISSION); msg.arg1 = allow ? 1 : 0; msg.sendToTarget(); } } No newline at end of file Loading
tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java +16 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.dumprendertree2; import android.net.Uri; import android.util.Log; import android.webkit.MockGeolocation; import android.webkit.WebStorage; import java.io.File; Loading Loading @@ -73,4 +74,19 @@ public class LayoutTestController { WebStorage.getInstance().setQuotaForOrigin(Uri.fromFile(new File("")).toString(), quota); } public void setGeolocationPermission(boolean allow) { mLayoutTestsExecutor.setGeolocationPermission(allow); } public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) { Log.w(LOG_TAG + "::setMockGeolocationPosition", "latitude: " + latitude + " longitude: " + longitude + " accuracy: " + accuracy); MockGeolocation.getInstance().setPosition(latitude, longitude, accuracy); } public void setMockGeolocationError(int code, String message) { Log.w(LOG_TAG + "::setMockGeolocationError", "code: " + code + " message: " + message); MockGeolocation.getInstance().setError(code, message); } } No newline at end of file
tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java +25 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.webkit.GeolocationPermissions.Callback; import android.webkit.WebStorage.QuotaUpdater; import java.io.File; Loading Loading @@ -104,6 +105,8 @@ public class LayoutTestsExecutor extends Activity { private LayoutTestController mLayoutTestController = new LayoutTestController(this); private boolean mCanOpenWindows; private boolean mDumpDatabaseCallbacks; private boolean mSetGeolocationPermissionCalled; private boolean mGeolocationPermission; private WakeLock mScreenDimLock; Loading Loading @@ -221,6 +224,13 @@ public class LayoutTestsExecutor extends Activity { resultMsg.sendToTarget(); return true; } @Override public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { if (mSetGeolocationPermissionCalled) { callback.invoke(origin, mGeolocationPermission, false); } } }; /** IMPLEMENTATION */ Loading Loading @@ -420,6 +430,7 @@ public class LayoutTestsExecutor extends Activity { private static final int MSG_DUMP_CHILD_FRAMES_AS_TEXT = 3; 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_PREMISSION = 6; Handler mLayoutTestControllerHandler = new Handler() { @Override Loading Loading @@ -468,6 +479,11 @@ public class LayoutTestsExecutor extends Activity { mDumpDatabaseCallbacks = true; break; case MSG_SET_GEOLOCATION_PREMISSION: mSetGeolocationPermissionCalled = true; mGeolocationPermission = msg.arg1 == 1; break; default: Log.w(LOG_TAG + "::handleMessage", "Message code does not exist: " + msg.what); break; Loading @@ -478,6 +494,8 @@ public class LayoutTestsExecutor extends Activity { private void resetLayoutTestController() { mCanOpenWindows = false; mDumpDatabaseCallbacks = false; mSetGeolocationPermissionCalled = false; mGeolocationPermission = false; } public void waitUntilDone() { Loading Loading @@ -513,4 +531,11 @@ public class LayoutTestsExecutor extends Activity { Log.w(LOG_TAG + "::dumpDatabaseCallbacks:", "called"); mLayoutTestControllerHandler.sendEmptyMessage(MSG_DUMP_DATABASE_CALLBACKS); } public void setGeolocationPermission(boolean allow) { Log.w(LOG_TAG + "::setGeolocationPermission", "called"); Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_SET_GEOLOCATION_PREMISSION); msg.arg1 = allow ? 1 : 0; msg.sendToTarget(); } } No newline at end of file