diff options
author | Steve Block <steveblock@google.com> | 2010-08-18 15:15:42 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-08-18 15:50:48 +0100 |
commit | f0f30c677a187b0436e62d2be6c97b76e61d74ea (patch) | |
tree | a5eef9d49af6807458e85f85dd3a3080bd0116cf /tests/DumpRenderTree | |
parent | 0e4d86fddf2c9664f2fd44247e5688f077b95d5e (diff) | |
download | frameworks_base-f0f30c677a187b0436e62d2be6c97b76e61d74ea.zip frameworks_base-f0f30c677a187b0436e62d2be6c97b76e61d74ea.tar.gz frameworks_base-f0f30c677a187b0436e62d2be6c97b76e61d74ea.tar.bz2 |
Implement logic for new Geolocation delayed permission LayoutTests
Bug: 2914450
Change-Id: Ic0be3120e88efe9199f7719b9ccb1090baaabed6
Diffstat (limited to 'tests/DumpRenderTree')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java | 2 | ||||
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | 27 |
2 files changed, 24 insertions, 5 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java index 784a6d5..9f580a3 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java @@ -89,8 +89,6 @@ public class FileFilter { // This first block of tests are for features for which Android // should pass all tests. They are skipped only temporarily. // TODO: Fix these failing tests and remove them from this list. - ignoreResultList.add("fast/dom/Geolocation/delayed-permission-allowed.html"); // requires layoutTestController.permissionSet - ignoreResultList.add("fast/dom/Geolocation/delayed-permission-denied.html"); // requires layoutTestController.permissionSet ignoreResultList.add("fast/events/touch/basic-multi-touch-events.html"); // Requires multi-touch ignoreResultList.add("fast/events/touch/touch-target.html"); // Requires multi-touch ignoreResultList.add("http/tests/appcache/empty-manifest.html"); // flaky diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index db076da..40af8c0 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -57,6 +57,7 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Vector; @@ -493,8 +494,19 @@ public class TestShellActivity extends Activity implements LayoutTestController * Sets the Geolocation permission state to be used for all future requests. */ public void setGeolocationPermission(boolean allow) { - mGeolocationPermissionSet = true; + mIsGeolocationPermissionSet = true; mGeolocationPermission = allow; + + if (mPendingGeolocationPermissionCallbacks != null) { + Iterator iter = mPendingGeolocationPermissionCallbacks.keySet().iterator(); + while (iter.hasNext()) { + GeolocationPermissions.Callback callback = + (GeolocationPermissions.Callback) iter.next(); + String origin = (String) mPendingGeolocationPermissionCallbacks.get(callback); + callback.invoke(origin, mGeolocationPermission, false); + } + mPendingGeolocationPermissionCallbacks = null; + } } public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha, @@ -697,9 +709,15 @@ public class TestShellActivity extends Activity implements LayoutTestController @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { - if (mGeolocationPermissionSet) { + if (mIsGeolocationPermissionSet) { callback.invoke(origin, mGeolocationPermission, false); + return; + } + if (mPendingGeolocationPermissionCallbacks == null) { + mPendingGeolocationPermissionCallbacks = + new HashMap<GeolocationPermissions.Callback, String>(); } + mPendingGeolocationPermissionCallbacks.put(callback, origin); } @Override @@ -785,6 +803,8 @@ public class TestShellActivity extends Activity implements LayoutTestController mGetDrawtime = false; mSaveImagePath = null; setDefaultWebSettings(mWebView); + mIsGeolocationPermissionSet = false; + mPendingGeolocationPermissionCallbacks = null; } private long[] getDrawWebViewTime(WebView view, int count) { @@ -920,6 +940,7 @@ public class TestShellActivity extends Activity implements LayoutTestController static final String DRAW_TIME_LOG = Environment.getExternalStorageDirectory() + "/android/page_draw_time.txt"; - private boolean mGeolocationPermissionSet; + private boolean mIsGeolocationPermissionSet; private boolean mGeolocationPermission; + private Map mPendingGeolocationPermissionCallbacks; } |