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

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

Issue 2076463002: [Custom Tabs] Implement "Read It Later" Behind a Flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 6 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 | « chrome/android/java/strings/android_chrome_strings.grd ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
index 27b5407cbf0bba738ff89d0f4ba4002da634ab5b..0cfb817f5839b603e43fe4d4cf61f36cf6e83774 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -49,6 +49,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.IntentHandler;
@@ -107,6 +108,7 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
}
}
+ private static final String READ_IT_LATER_FEATURE = "ReadItLaterInMenu";
private static final int MAX_MENU_CUSTOM_ITEMS = 5;
private static final int NUM_CHROME_MENU_ITEMS = 3;
private static final String
@@ -346,7 +348,8 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
openAppMenuAndAssertMenuShown();
Menu menu = getActivity().getAppMenuHandler().getAppMenu().getMenu();
- final int expectedMenuSize = numMenuEntries + NUM_CHROME_MENU_ITEMS;
+ final int expectedMenuSize = numMenuEntries + NUM_CHROME_MENU_ITEMS
+ + (ChromeFeatureList.isEnabled(READ_IT_LATER_FEATURE) ? 1 : 0);
final int actualMenuSize = getActualMenuSize(menu);
assertNotNull("App menu is not initialized: ", menu);
@@ -389,7 +392,8 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
openAppMenuAndAssertMenuShown();
Menu menu = getActivity().getAppMenuHandler().getAppMenu().getMenu();
- final int expectedMenuSize = MAX_MENU_CUSTOM_ITEMS + NUM_CHROME_MENU_ITEMS;
+ final int expectedMenuSize = MAX_MENU_CUSTOM_ITEMS + NUM_CHROME_MENU_ITEMS
+ + (ChromeFeatureList.isEnabled(READ_IT_LATER_FEATURE) ? 1 : 0);
final int actualMenuSize = getActualMenuSize(menu);
assertNotNull("App menu is not initialized: ", menu);
assertEquals(expectedMenuSize, actualMenuSize);
@@ -433,27 +437,31 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
@SmallTest
public void testOpenInBrowser() throws InterruptedException {
startCustomTabActivityWithIntent(createMinimalCustomTabIntent());
- IntentFilter filter = new IntentFilter(Intent.ACTION_VIEW);
- filter.addDataScheme(Uri.parse(mTestServer.getURL("/")).getScheme());
- final ActivityMonitor monitor = getInstrumentation().addMonitor(filter, null, false);
openAppMenuAndAssertMenuShown();
- final String menuItemTitle = mActivity.getString(R.string.menu_open_in_product_default);
- ThreadUtils.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- MenuItem item = mActivity.getAppMenuHandler()
- .getAppMenu().getMenu().findItem(R.id.open_in_browser_id);
- assertNotNull(item);
- assertEquals(menuItemTitle, item.getTitle().toString());
- mActivity.onMenuOrKeyboardAction(R.id.open_in_browser_id, false);
- }
- });
- CriteriaHelper.pollInstrumentationThread(new Criteria() {
- @Override
- public boolean isSatisfied() {
- return getInstrumentation().checkMonitorHit(monitor, 1);
- }
- });
+ if (ChromeFeatureList.isEnabled(READ_IT_LATER_FEATURE)) {
+ // TODO(ianwen): implement this test after read it later becomes a settled feature.
+ } else {
+ IntentFilter filter = new IntentFilter(Intent.ACTION_VIEW);
+ filter.addDataScheme(Uri.parse(mTestServer.getURL("/")).getScheme());
+ final ActivityMonitor monitor = getInstrumentation().addMonitor(filter, null, false);
+ final String menuItemTitle = mActivity.getString(R.string.menu_open_in_product_default);
+ ThreadUtils.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ MenuItem item = mActivity.getAppMenuHandler()
+ .getAppMenu().getMenu().findItem(R.id.open_in_browser_id);
+ assertNotNull(item);
+ assertEquals(menuItemTitle, item.getTitle().toString());
+ mActivity.onMenuOrKeyboardAction(R.id.open_in_browser_id, false);
+ }
+ });
+ CriteriaHelper.pollInstrumentationThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return getInstrumentation().checkMonitorHit(monitor, 1);
+ }
+ });
+ }
}
/**
@@ -1287,7 +1295,7 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
- mActivity.openCurrentUrlInBrowser(true);
+ mActivity.openCurrentUrlInBrowser(true, true);
assertNull(mActivity.getActivityTab());
}
});
« no previous file with comments | « chrome/android/java/strings/android_chrome_strings.grd ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698