Index: content/public/android/javatests/src/org/chromium/content/browser/ContentViewPopupZoomerTest.java |
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPopupZoomerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPopupZoomerTest.java |
index 4d31c2bb5c408b0b4ab05cd30c378eec58d596ec..7dfcf8818829bb60d3a7215de4127a269b337902 100644 |
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPopupZoomerTest.java |
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewPopupZoomerTest.java |
@@ -5,6 +5,7 @@ |
package org.chromium.content.browser; |
import android.test.suitebuilder.annotation.MediumTest; |
+import android.view.KeyEvent; |
import android.view.View; |
import android.view.ViewGroup; |
@@ -17,6 +18,9 @@ import org.chromium.content_shell_apk.ContentShellTestBase; |
import java.util.concurrent.TimeoutException; |
+/** |
+ * Class which provides test coverage for Popup Zoomer. |
+ */ |
public class ContentViewPopupZoomerTest extends ContentShellTestBase { |
private static PopupZoomer findPopupZoomer(ViewGroup view) { |
assert view != null; |
@@ -98,4 +102,24 @@ public class ContentViewPopupZoomerTest extends ContentShellTestBase { |
// The shown popup should have valid dimensions eventually. |
CriteriaHelper.pollInstrumentationThread(new PopupHasNonZeroDimensionsCriteria(view)); |
} |
+ |
+ /** |
+ * Tests Popup zoomer hides when device back key is pressed. |
+ */ |
+ @MediumTest |
+ @Feature({"Browser"}) |
+ public void testBackKeyDismissesPopupZoomer() throws InterruptedException, TimeoutException { |
+ launchContentShellWithUrl(generateTestUrl(100, 15, "clickme")); |
+ waitForActiveShellToBeDoneLoading(); |
+ |
+ final ContentViewCore viewCore = getContentViewCore(); |
+ final ViewGroup view = viewCore.getContainerView(); |
+ |
+ CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view, false)); |
+ DOMUtils.clickNode(this, viewCore, "clickme"); |
+ CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view, true)); |
+ sendKeys(KeyEvent.KEYCODE_BACK); |
+ // When device key is pressed, popup zoomer should hide if already showing. |
+ CriteriaHelper.pollInstrumentationThread(new PopupShowingCriteria(view, false)); |
+ } |
} |