diff options
author | Steve Block <steveblock@google.com> | 2012-05-16 12:41:18 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2012-05-22 12:07:55 +0100 |
commit | f3f60d9328d8acfedf987a73631fc90c39bf5447 (patch) | |
tree | 1df1425cd3c08ef1e29dee80877406332eafa873 /tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | |
parent | 32a85291efb1b5ef0c3dbd7b581df27f1d03305a (diff) |
Switch Geolocation DRT methods to control client-based mock
Note that we plumb DRT Geolocation mock calls via WebView. This is required
because the WebCore client-based mock is not a static but is tied to the Page.
See WebKit change Ib74a3c05991593e75c3138415d4ac0bf0c9aefa9.
Bug: 6511338
Change-Id: I6d88d5dce5c2148812b191a5b452718bf0854aeb
Diffstat (limited to 'tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index bbfbfc4365ac..2b58f14bae91 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -539,24 +539,22 @@ public class TestShellActivity extends Activity implements LayoutTestController mCanOpenWindows = true; } - /** - * Sets the Geolocation permission state to be used for all future requests. - */ + @Override + public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) { + WebViewClassic.fromWebView(mWebView).setMockGeolocationPosition(latitude, + longitude, + accuracy); + } + + @Override + public void setMockGeolocationError(int code, String message) { + WebViewClassic.fromWebView(mWebView).setMockGeolocationError(code, message); + } + @Override public void setGeolocationPermission(boolean allow) { - 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; - } + Log.v(LOGTAG, "setGeolocationPermission() allow=" + allow); + WebViewClassic.fromWebView(mWebView).setMockGeolocationPermission(allow); } @Override @@ -749,22 +747,11 @@ public class TestShellActivity extends Activity implements LayoutTestController callback.updateQuota(currentQuota + 1024 * 1024 * 5); } - /** - * Instructs the client to show a prompt to ask the user to set the - * Geolocation permission state for the specified origin. - */ @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { - if (mIsGeolocationPermissionSet) { - callback.invoke(origin, mGeolocationPermission, false); - return; - } - if (mPendingGeolocationPermissionCallbacks == null) { - mPendingGeolocationPermissionCallbacks = - new HashMap<GeolocationPermissions.Callback, String>(); - } - mPendingGeolocationPermissionCallbacks.put(callback, origin); + throw new RuntimeException( + "The WebCore mock used by DRT should bypass the usual permissions flow."); } @Override @@ -849,9 +836,8 @@ public class TestShellActivity extends Activity implements LayoutTestController mPageFinished = false; mDumpWebKitData = false; setDefaultWebSettings(mWebView); - mIsGeolocationPermissionSet = false; - mPendingGeolocationPermissionCallbacks = null; CookieManager.getInstance().removeAllCookie(); + mWebViewClassic.setUseMockGeolocation(); } private boolean canMoveToNextTest() { @@ -958,8 +944,4 @@ public class TestShellActivity extends Activity implements LayoutTestController static final int DRAW_RUNS = 5; static final String DRAW_TIME_LOG = Environment.getExternalStorageDirectory() + "/android/page_draw_time.txt"; - - private boolean mIsGeolocationPermissionSet; - private boolean mGeolocationPermission; - private Map mPendingGeolocationPermissionCallbacks; } |