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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/ChromeHomeAppMenuTest.java

Issue 2821223004: [Home] Show the app menu icons as a footer (Closed)
Patch Set: 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/ChromeHomeAppMenuTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/ChromeHomeAppMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/ChromeHomeAppMenuTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..127f021ce0d3a2c578c73ad433609f5ed55e150a
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/ChromeHomeAppMenuTest.java
@@ -0,0 +1,88 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.appmenu;
+
+import android.support.test.filters.SmallTest;
+
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.UrlUtils;
+import org.chromium.chrome.test.BottomSheetTestCaseBase;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
+
+/**
+ * Tests for the app menu when Chrome Home is enabled.
+ */
+public class ChromeHomeAppMenuTest extends BottomSheetTestCaseBase {
+ private static final String TEST_URL = UrlUtils.encodeHtmlDataUri("<html>poit.</html>");
+
+ private AppMenu mAppMenu;
+ private AppMenuHandler mAppMenuHandler;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ mAppMenuHandler = getActivity().getAppMenuHandler();
+ showAppMenuAndAssertMenuShown();
+ mAppMenu = getActivity().getAppMenuHandler().getAppMenu();
+ getInstrumentation().waitForIdleSync();
Ted C 2017/04/18 22:58:46 why do we need this? Actually...why do we need sh
Theresa 2017/04/18 23:30:59 Done.
+ }
+
+ @SmallTest
+ public void testPageMenu() throws IllegalArgumentException, InterruptedException {
+ loadUrl(TEST_URL);
+
+ AppMenuIconRowFooter iconRow = (AppMenuIconRowFooter) mAppMenu.getPromptView();
+
+ assertFalse(iconRow.getForwardButtonForTests().isEnabled());
+ assertTrue(iconRow.getBookmarkButtonForTests().isEnabled());
+ // Only HTTP/S pages can be downloaded.
+ assertFalse(iconRow.getDownloadButtonForTests().isEnabled());
+ assertTrue(iconRow.getPageInfoButtonForTests().isEnabled());
+ assertTrue(iconRow.getReloadButtonForTests().isEnabled());
+
+ // Navigate backward, open the menu and assert forward button is enabled.
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ mAppMenuHandler.hideAppMenu();
+ getActivity().getActivityTab().goBack();
+ }
+ });
+
+ showAppMenuAndAssertMenuShown();
+ iconRow = (AppMenuIconRowFooter) mAppMenu.getPromptView();
+ assertTrue(iconRow.getForwardButtonForTests().isEnabled());
+ }
+
+ @SmallTest
+ public void testTabSwitcherMenu() throws IllegalArgumentException {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ getActivity().getLayoutManager().showOverview(false);
+ }
+ });
+ showAppMenuAndAssertMenuShown();
+
+ assertNull(mAppMenu.getPromptView());
+ }
+
+ private void showAppMenuAndAssertMenuShown() {
+ ThreadUtils.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mAppMenuHandler.showAppMenu(null, false);
+ }
+ });
+ CriteriaHelper.pollInstrumentationThread(new Criteria("AppMenu did not show") {
Ted C 2017/04/18 22:58:46 why the instrumentation thread?
Theresa 2017/04/18 23:30:59 Changed it to poll the UI thread.
+ @Override
+ public boolean isSatisfied() {
+ return mAppMenuHandler.isAppMenuShowing();
+ }
+ });
+ }
+}
« chrome/android/java/res/values-v17/styles.xml ('K') | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698