am 25131299: Merge change 21978 into eclair
Merge commit '25131299aaa1b8c4f44edb33f71f0241a61939e4' into eclair-plus-aosp * commit '25131299aaa1b8c4f44edb33f71f0241a61939e4': Adds the ability to set Geolocation permissions from DumpRenderTree on Android.
This commit is contained in:
@@ -61,6 +61,7 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
|||||||
private static final int LAYOUT_WAIT_UNTIL_DONE = 40;
|
private static final int LAYOUT_WAIT_UNTIL_DONE = 40;
|
||||||
private static final int LAYOUT_DUMP_DATABASE_CALLBACKS = 41;
|
private static final int LAYOUT_DUMP_DATABASE_CALLBACKS = 41;
|
||||||
private static final int LAYOUT_SET_CAN_OPEN_WINDOWS = 42;
|
private static final int LAYOUT_SET_CAN_OPEN_WINDOWS = 42;
|
||||||
|
private static final int SET_GEOLOCATION_PERMISSION = 43;
|
||||||
|
|
||||||
CallbackProxy(EventSender eventSender,
|
CallbackProxy(EventSender eventSender,
|
||||||
LayoutTestController layoutTestController) {
|
LayoutTestController layoutTestController) {
|
||||||
@@ -202,6 +203,11 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
|||||||
case LAYOUT_SET_CAN_OPEN_WINDOWS:
|
case LAYOUT_SET_CAN_OPEN_WINDOWS:
|
||||||
mLayoutTestController.setCanOpenWindows();
|
mLayoutTestController.setCanOpenWindows();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SET_GEOLOCATION_PERMISSION:
|
||||||
|
mLayoutTestController.setGeolocationPermission(
|
||||||
|
msg.arg1 == 1 ? true : false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,4 +370,8 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
|||||||
public void setMockGeolocationError(int code, String message) {
|
public void setMockGeolocationError(int code, String message) {
|
||||||
MockGeolocation.getInstance().setError(code, message);
|
MockGeolocation.getInstance().setError(code, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGeolocationPermission(boolean allow) {
|
||||||
|
obtainMessage(SET_GEOLOCATION_PERMISSION, allow ? 1 : 0, 0).sendToTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,4 +62,7 @@ public interface LayoutTestController {
|
|||||||
// For storage tests
|
// For storage tests
|
||||||
public void dumpDatabaseCallbacks();
|
public void dumpDatabaseCallbacks();
|
||||||
public void setCanOpenWindows();
|
public void setCanOpenWindows();
|
||||||
|
|
||||||
|
// For Geolocation tests
|
||||||
|
public void setGeolocationPermission(boolean allow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.webkit.GeolocationPermissions;
|
||||||
import android.webkit.HttpAuthHandler;
|
import android.webkit.HttpAuthHandler;
|
||||||
import android.webkit.JsPromptResult;
|
import android.webkit.JsPromptResult;
|
||||||
import android.webkit.JsResult;
|
import android.webkit.JsResult;
|
||||||
@@ -425,6 +426,14 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
|||||||
mCanOpenWindows = true;
|
mCanOpenWindows = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Geolocation permission state to be used for all future requests.
|
||||||
|
*/
|
||||||
|
public void setGeolocationPermission(boolean allow) {
|
||||||
|
mGeolocationPermissionSet = true;
|
||||||
|
mGeolocationPermission = allow;
|
||||||
|
}
|
||||||
|
|
||||||
private final WebViewClient mViewClient = new WebViewClient(){
|
private final WebViewClient mViewClient = new WebViewClient(){
|
||||||
@Override
|
@Override
|
||||||
public void onPageFinished(WebView view, String url) {
|
public void onPageFinished(WebView view, String url) {
|
||||||
@@ -575,6 +584,18 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
|||||||
callback.updateQuota(currentQuota + 1024 * 1024 * 5);
|
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 (mGeolocationPermissionSet) {
|
||||||
|
callback.invoke(origin, mGeolocationPermission, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addMessageToConsole(String message, int lineNumber,
|
public void addMessageToConsole(String message, int lineNumber,
|
||||||
String sourceID) {
|
String sourceID) {
|
||||||
@@ -687,4 +708,7 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
|||||||
static final String RESULT_FILE = "ResultFile";
|
static final String RESULT_FILE = "ResultFile";
|
||||||
static final String TIMEOUT_IN_MILLIS = "TimeoutInMillis";
|
static final String TIMEOUT_IN_MILLIS = "TimeoutInMillis";
|
||||||
static final String UI_AUTO_TEST = "UiAutoTest";
|
static final String UI_AUTO_TEST = "UiAutoTest";
|
||||||
|
|
||||||
|
private boolean mGeolocationPermissionSet;
|
||||||
|
private boolean mGeolocationPermission;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user