| Index: content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTest.java b/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTest.java
|
| index 2b4f8d3ff7d2e91b62f6683c3ad1056851f4a6e2..8f44ed73c25347d13e34d423ce7244b291f9a0f8 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTest.java
|
| @@ -54,6 +54,8 @@ public class DialogOverlayImplTest extends ContentShellTestBase {
|
| public static final int CONNECTION_ERROR = 2;
|
| // AndroidOverlayProviderImpl.Callbacks
|
| public static final int RELEASED = 100;
|
| + // Internal to test only.
|
| + public static final int TEST_MARKER = 200;
|
|
|
| /**
|
| * Records one callback event.
|
| @@ -109,6 +111,11 @@ public class DialogOverlayImplTest extends ContentShellTestBase {
|
| mPending.add(new Event(RELEASED));
|
| }
|
|
|
| + // Inject a marker event, so that the test can checkpoint things.
|
| + public void injectMarkerEvent() {
|
| + mPending.add(new Event(TEST_MARKER));
|
| + }
|
| +
|
| // Wait for something to happen. We enforce a timeout, since the test harness doesn't
|
| // always seem to fail the test when it times out. Plus, it takes ~minute for that, but
|
| // none of our messages should take that long.
|
| @@ -261,4 +268,28 @@ public class DialogOverlayImplTest extends ContentShellTestBase {
|
| Assert.assertEquals(Client.SURFACE_READY, event.which);
|
| Assert.assertTrue(event.surfaceKey > 0);
|
| }
|
| +
|
| + @SmallTest
|
| + @Feature({"AndroidOverlay"})
|
| + public void testCloseOnlyClosesOnce() {
|
| + // Test that trying to close an overlay more than once doesn't actually do anything.
|
| + final DialogOverlayImpl overlay = createOverlay(0, 0, 10, 10);
|
| + // The first should generate RELEASED
|
| + ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + overlay.close();
|
| + }
|
| + });
|
| + Assert.assertEquals(Client.RELEASED, mClient.nextEvent().which);
|
| +
|
| + ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + overlay.close();
|
| + mClient.injectMarkerEvent();
|
| + }
|
| + });
|
| + Assert.assertEquals(Client.TEST_MARKER, mClient.nextEvent().which);
|
| + }
|
| }
|
|
|