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

Unified Diff: android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java

Issue 2819563003: Wait longer for actionmode menu in webview actionmode tests (Closed)
Patch Set: Clarify the ActionBar idling resource logic Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java
diff --git a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java
index eb9dc56bc4b389020ff62243c9584f0ffb4e2378..fc10cc372690a093b71722169d72b3ad6f960ecb 100644
--- a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java
+++ b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java
@@ -293,6 +293,7 @@ public class ActionModeTest {
private class ActionBarIdlingResource implements IdlingResource {
private boolean mActionStarting;
private ResourceCallback mResourceCallback;
+ private boolean mPreviousActionBarDisplayed;
@Override
public String getName() {
@@ -302,10 +303,17 @@ public class ActionModeTest {
@Override
public boolean isIdleNow() {
if (!mActionStarting) return true;
- if (mWebViewActivityRule.isActionBarDisplayed()) {
+ boolean currentActionBarDisplayed = mWebViewActivityRule.isActionBarDisplayed();
+ /* Only transition to idle when action bar is displayed fully for
+ * 2 consecutive checks. This avoids false transitions
+ * in cases where the action bar was already displayed but is due
+ * to be updated immediately after a previous action
+ */
+ if (mPreviousActionBarDisplayed && currentActionBarDisplayed) {
mActionStarting = false;
if (mResourceCallback != null) mResourceCallback.onTransitionToIdle();
}
+ mPreviousActionBarDisplayed = currentActionBarDisplayed;
return !mActionStarting;
}
@@ -316,6 +324,7 @@ public class ActionModeTest {
public void start() {
mActionStarting = true;
+ mPreviousActionBarDisplayed = false;
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698