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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java

Issue 2596973002: [Android] Update CCT/Herb menu item (Closed)
Patch Set: Update based on Ted's comments. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 8
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.Application; 10 import android.app.Application;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 import java.util.concurrent.Callable; 90 import java.util.concurrent.Callable;
91 import java.util.concurrent.TimeoutException; 91 import java.util.concurrent.TimeoutException;
92 import java.util.concurrent.atomic.AtomicBoolean; 92 import java.util.concurrent.atomic.AtomicBoolean;
93 import java.util.concurrent.atomic.AtomicReference; 93 import java.util.concurrent.atomic.AtomicReference;
94 94
95 /** 95 /**
96 * Instrumentation tests for app menu, context menu, and toolbar of a {@link Cus tomTabActivity}. 96 * Instrumentation tests for app menu, context menu, and toolbar of a {@link Cus tomTabActivity}.
97 */ 97 */
98 public class CustomTabActivityTest extends CustomTabActivityTestBase { 98 public class CustomTabActivityTest extends CustomTabActivityTestBase {
99 private static final int MAX_MENU_CUSTOM_ITEMS = 5; 99 private static final int MAX_MENU_CUSTOM_ITEMS = 5;
100 private static final int NUM_CHROME_MENU_ITEMS = 2; 100 private static final int NUM_CHROME_MENU_ITEMS = 5;
101 private static final String TEST_PAGE = "/chrome/test/data/android/google.ht ml"; 101 private static final String TEST_PAGE = "/chrome/test/data/android/google.ht ml";
102 private static final String TEST_PAGE_2 = "/chrome/test/data/android/test.ht ml"; 102 private static final String TEST_PAGE_2 = "/chrome/test/data/android/test.ht ml";
103 private static final String GEOLOCATION_PAGE = 103 private static final String GEOLOCATION_PAGE =
104 "/chrome/test/data/geolocation/geolocation_on_load.html"; 104 "/chrome/test/data/geolocation/geolocation_on_load.html";
105 private static final String SELECT_POPUP_PAGE = "/chrome/test/data/android/s elect.html"; 105 private static final String SELECT_POPUP_PAGE = "/chrome/test/data/android/s elect.html";
106 private static final String FRAGMENT_TEST_PAGE = "/chrome/test/data/android/ fragment.html"; 106 private static final String FRAGMENT_TEST_PAGE = "/chrome/test/data/android/ fragment.html";
107 private static final String TEST_MENU_TITLE = "testMenuTitle"; 107 private static final String TEST_MENU_TITLE = "testMenuTitle";
108 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; 108 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome";
109 private static final String WEBLITE_PREFIX = "http://googleweblight.com/?lit e_url="; 109 private static final String WEBLITE_PREFIX = "http://googleweblight.com/?lit e_url=";
110 private static final String JS_MESSAGE = "from_js"; 110 private static final String JS_MESSAGE = "from_js";
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 startCustomTabActivityWithIntent(intent); 368 startCustomTabActivityWithIntent(intent);
369 369
370 openAppMenuAndAssertMenuShown(); 370 openAppMenuAndAssertMenuShown();
371 Menu menu = getActivity().getAppMenuHandler().getAppMenu().getMenu(); 371 Menu menu = getActivity().getAppMenuHandler().getAppMenu().getMenu();
372 final int expectedMenuSize = numMenuEntries + NUM_CHROME_MENU_ITEMS; 372 final int expectedMenuSize = numMenuEntries + NUM_CHROME_MENU_ITEMS;
373 final int actualMenuSize = getActualMenuSize(menu); 373 final int actualMenuSize = getActualMenuSize(menu);
374 374
375 assertNotNull("App menu is not initialized: ", menu); 375 assertNotNull("App menu is not initialized: ", menu);
376 assertEquals(expectedMenuSize, actualMenuSize); 376 assertEquals(expectedMenuSize, actualMenuSize);
377 assertNotNull(menu.findItem(R.id.forward_menu_id)); 377 assertNotNull(menu.findItem(R.id.forward_menu_id));
378 assertNotNull(menu.findItem(R.id.bookmark_this_page_id));
379 assertNotNull(menu.findItem(R.id.offline_page_id));
378 assertNotNull(menu.findItem(R.id.info_menu_id)); 380 assertNotNull(menu.findItem(R.id.info_menu_id));
379 assertNotNull(menu.findItem(R.id.reload_menu_id)); 381 assertNotNull(menu.findItem(R.id.reload_menu_id));
380 assertNotNull(menu.findItem(R.id.open_in_browser_id)); 382 assertNotNull(menu.findItem(R.id.open_in_browser_id));
381 assertFalse(menu.findItem(R.id.share_row_menu_id).isVisible()); 383 assertFalse(menu.findItem(R.id.share_row_menu_id).isVisible());
382 assertFalse(menu.findItem(R.id.share_row_menu_id).isEnabled()); 384 assertFalse(menu.findItem(R.id.share_row_menu_id).isEnabled());
383 assertNull(menu.findItem(R.id.bookmark_this_page_id)); 385 assertNotNull(menu.findItem(R.id.find_in_page_id));
384 assertNull(menu.findItem(R.id.find_in_page_id)); 386 assertNotNull(menu.findItem(R.id.add_to_homescreen_id));
387 assertNotNull(menu.findItem(R.id.request_desktop_site_id));
385 } 388 }
386 389
387 /** 390 /**
388 * Tests if the default share item can be shown in the app menu. 391 * Tests if the default share item can be shown in the app menu.
389 */ 392 */
390 @SmallTest 393 @SmallTest
391 @RetryOnFailure 394 @RetryOnFailure
392 public void testShareMenuItem() throws InterruptedException { 395 public void testShareMenuItem() throws InterruptedException {
393 Intent intent = createMinimalCustomTabIntent(); 396 Intent intent = createMinimalCustomTabIntent();
394 intent.putExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, true); 397 intent.putExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, true);
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; 1858 if (jsonText.equalsIgnoreCase("null")) jsonText = "";
1856 value = jsonText; 1859 value = jsonText;
1857 } catch (InterruptedException | TimeoutException e) { 1860 } catch (InterruptedException | TimeoutException e) {
1858 e.printStackTrace(); 1861 e.printStackTrace();
1859 return false; 1862 return false;
1860 } 1863 }
1861 return TextUtils.equals(mExpected, value); 1864 return TextUtils.equals(mExpected, value);
1862 } 1865 }
1863 } 1866 }
1864 } 1867 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698