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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java

Issue 1209243003: Changed the constraints for hiding the top controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Used pollForUIThreadCriteria instead of pollForCriteria in the test code Created 5 years, 5 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java
index de712f35744a0cf043a0036543ee1a7f0da79e9f..48a85f7a93abc8c137f293a72d52047297b895d9 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java
@@ -43,6 +43,15 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class FullscreenManagerTest extends ChromeTabbedActivityTestBase {
+ private static final String LONG_HTML_WITH_AUTO_FOCUS_INPUT_TEST_PAGE =
+ UrlUtils.encodeHtmlDataUri("<html>"
+ + "<body style='height:10000px;'>"
+ + "<p>The text input is focused automatically on load."
+ + " The top controls should not hide when page is scrolled.</p><br/>"
+ + "<input id=\"input_text\" type=\"text\" autofocus/>"
+ + "</body>"
+ + "</html>");
+
private static final String LONG_HTML_TEST_PAGE = UrlUtils.encodeHtmlDataUri(
"<html><body style='height:10000px;'></body></html>");
private static final String LONG_FULLSCREEN_API_HTML_TEST_PAGE = UrlUtils.encodeHtmlDataUri(
@@ -320,6 +329,35 @@ public class FullscreenManagerTest extends ChromeTabbedActivityTestBase {
scrollTopControls(false);
}
+ @LargeTest
+ @Feature({"Fullscreen"})
+ public void testTopControlsShownWhenInputIsFocused()
+ throws InterruptedException, ExecutionException {
+ startMainActivityWithURL(LONG_HTML_WITH_AUTO_FOCUS_INPUT_TEST_PAGE);
+
+ ChromeFullscreenManager fullscreenManager = getActivity().getFullscreenManager();
+ assertEquals(fullscreenManager.getControlOffset(), 0f);
+
+ fullscreenManager.setAnimationDurationsForTest(1, 1);
+
+ int topControlsHeight = fullscreenManager.getTopControlsHeight();
+ float dragX = 50f;
+ float dragStartY = topControlsHeight * 3;
+ float dragEndY = dragStartY - topControlsHeight * 2;
+ long downTime = SystemClock.uptimeMillis();
+ dragStart(dragX, dragStartY, downTime);
+ dragTo(dragX, dragX, dragStartY, dragEndY, 100, downTime);
+ dragEnd(dragX, dragEndY, downTime);
+ assertTrue(waitForNoBrowserTopControlsOffset());
+ assertEquals(fullscreenManager.getControlOffset(), 0f);
+
+ Tab tab = getActivity().getActivityTab();
+ singleClickView(tab.getView());
+ waitForEditableNodeToLoseFocus(tab);
+ scrollTopControls(false);
+ scrollTopControls(true);
+ }
+
private void scrollTopControls(boolean show) throws InterruptedException, ExecutionException {
ChromeFullscreenManager fullscreenManager = getActivity().getFullscreenManager();
int topControlsHeight = fullscreenManager.getTopControlsHeight();
@@ -485,6 +523,16 @@ public class FullscreenManagerTest extends ChromeTabbedActivityTestBase {
});
}
+ private boolean waitForEditableNodeToLoseFocus(final Tab tab) throws InterruptedException {
+ return CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ ContentViewCore contentViewCore = tab.getContentViewCore();
+ return !contentViewCore.isFocusedNodeEditable();
+ }
+ });
+ }
+
@Override
protected void startMainActivityWithURL(String url) throws InterruptedException {
super.startMainActivityWithURL(url);

Powered by Google App Engine
This is Rietveld 408576698