| Index: chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java
|
| index db3903be6b3dfa20e7a2718c9f715bd33998cc00..79bf64b6eee491c61f4ca5f3bc9b3598e0031f9a 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java
|
| @@ -186,6 +186,47 @@ public class ModalDialogTest {
|
| Assert.assertEquals("Invalid return value.", '"' + promptText + '"', resultString);
|
| }
|
|
|
| + /**
|
| + * Verifies that message content in a dialog is only focusable if the message itself is long
|
| + * enough to require scrolling.
|
| + */
|
| + @Test
|
| + @MediumTest
|
| + @Feature({"Browser", "Main"})
|
| + public void testAlertModalDialogMessageFocus()
|
| + throws InterruptedException, TimeoutException, ExecutionException {
|
| + assertScrollViewFocusabilityInAlertDialog("alert('Short message!');", false);
|
| +
|
| + assertScrollViewFocusabilityInAlertDialog(
|
| + "alert(new Array(200).join('Long message!'));", true);
|
| + }
|
| +
|
| + private void assertScrollViewFocusabilityInAlertDialog(
|
| + final String jsAlertScript, boolean expectedFocusability)
|
| + throws InterruptedException, TimeoutException, ExecutionException {
|
| + final OnEvaluateJavaScriptResultHelper scriptEvent =
|
| + executeJavaScriptAndWaitForDialog(jsAlertScript);
|
| +
|
| + final JavascriptAppModalDialog jsDialog = getCurrentDialog();
|
| + Assert.assertNotNull("No dialog showing.", jsDialog);
|
| +
|
| + boolean isFocusable = ThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() {
|
| + @Override
|
| + public Boolean call() {
|
| + return jsDialog.getDialogForTest()
|
| + .findViewById(R.id.js_modal_dialog_scroll_view)
|
| + .isFocusable();
|
| + }
|
| + });
|
| +
|
| + Assert.assertEquals(
|
| + "Scroll view focusability was incorrect.", expectedFocusability, isFocusable);
|
| +
|
| + clickOk(jsDialog);
|
| + Assert.assertTrue("JavaScript execution should continue after closing prompt.",
|
| + scriptEvent.waitUntilHasValue());
|
| + }
|
| +
|
| private static class TapGestureStateListener extends GestureStateListener {
|
| private CallbackHelper mCallbackHelper = new CallbackHelper();
|
|
|
|
|