Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java

Issue 2877003002: (Android) Fix Bluetooth keyboard focus issues in settings (Closed)
Patch Set: Android: Only allow focus on JS AlertDialog messages with enough text to scroll Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698