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

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

Issue 2718243004: Reland of Wait for popup animation using idling resource for ActionMode Tests (Closed)
Patch Set: Created 3 years, 10 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 | « android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java ('k') | 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/util/WebViewUiTestRule.java
diff --git a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java
index d60a16bdab2229d689d4135494d0b5a28bef2b07..c3e6a72c666ca5f8e9ac50d404ac94bd20c600ae 100644
--- a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java
+++ b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/WebViewUiTestRule.java
@@ -4,7 +4,21 @@
package org.chromium.webview_ui_test.test.util;
+import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
+import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
+import static android.support.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.withChild;
+import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.hasItem;
+
import android.content.Intent;
+import android.os.Build;
+import android.support.test.espresso.BaseLayerComponent;
+import android.support.test.espresso.DaggerBaseLayerComponent;
import android.support.test.rule.ActivityTestRule;
import android.webkit.WebView;
@@ -25,6 +39,7 @@
private WebViewSyncWrapper mSyncWrapper;
private String mLayout;
+ private BaseLayerComponent mBaseLayerComponent;
public WebViewUiTestRule(Class<WebViewUiTestActivity> activityClass) {
super(activityClass);
@@ -81,4 +96,35 @@
Assert.fail(e.getMessage());
}
}
+
+ public boolean isActionBarDisplayed() {
+ if (mBaseLayerComponent == null) mBaseLayerComponent = DaggerBaseLayerComponent.create();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ // For M and above
+ if (hasItem(withDecorView(withChild(allOf(
+ withClassName(endsWith("PopupBackgroundView")),
+ isCompletelyDisplayed())))).matches(
+ mBaseLayerComponent.activeRootLister().listActiveRoots())) {
+ return true;
+ }
+ } else {
+ // For L
+ if (hasItem(withDecorView(hasDescendant(allOf(
+ withClassName(endsWith("ActionMenuItemView")),
+ isCompletelyDisplayed())))).matches(
+ mBaseLayerComponent.activeRootLister().listActiveRoots())) {
+ return true;
+ }
+
+ // Paste option is a popup on L
+ if (hasItem(withDecorView(withChild(withText("Paste")))).matches(
+ mBaseLayerComponent.activeRootLister().listActiveRoots())) {
+ return true;
+ }
+ }
+
+
+ return false;
+ }
}
« no previous file with comments | « android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/ActionModeTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698