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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/androidoverlay/DialogOverlayImplTest.java

Issue 2865823003: Make multiple calls to DialogOverlayImpl.close() do nothing. (Closed)
Patch Set: Created 3 years, 7 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 | « content/public/android/java/src/org/chromium/content/browser/androidoverlay/DialogOverlayImpl.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/androidoverlay/DialogOverlayImpl.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698