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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java

Issue 2013883002: ✈ Remove unnecessary flag and DocumentModeManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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/webapps/WebappModeTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
index 17fd403313d73b903cef6baf4c6c08f24bd75db0..c9f0ae4775f9ebe9bb84b60c8ce0141203826c3b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
@@ -8,32 +8,23 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.os.Build;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContextUtils;
import org.chromium.base.ThreadUtils;
-import org.chromium.base.test.util.CommandLineFlags;
-import org.chromium.base.test.util.DisabledTest;
-import org.chromium.base.test.util.MinAndroidSdkLevel;
-import org.chromium.base.test.util.Restriction;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.blink_public.platform.WebDisplayMode;
import org.chromium.chrome.browser.ChromeActivity;
-import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.browser.ShortcutSource;
-import org.chromium.chrome.browser.document.DocumentActivity;
-import org.chromium.chrome.browser.preferences.DocumentModeManager;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabIdManager;
import org.chromium.chrome.test.MultiActivityTestBase;
import org.chromium.chrome.test.util.ActivityUtils;
import org.chromium.chrome.test.util.ApplicationTestUtils;
-import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.browser.TabLoadObserver;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -225,8 +216,7 @@ public class WebappModeTest extends MultiActivityTestBase {
@Override
public boolean isSatisfied() {
Activity lastActivity = ApplicationStatus.getLastTrackedFocusedActivity();
- return lastActivity instanceof ChromeTabbedActivity
- || lastActivity instanceof DocumentActivity;
+ return lastActivity instanceof ChromeTabbedActivity;
}
});
ChromeActivity chromeActivity =
@@ -244,61 +234,21 @@ public class WebappModeTest extends MultiActivityTestBase {
}
/**
- * Tests that WebappActivities handle window.open() properly in document mode.
- */
- @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP)
- @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
- @DisabledTest
- public void testWebappHandlesWindowOpenInDocumentMode() throws Exception {
- triggerWindowOpenAndWaitForDocumentLoad(ONCLICK_LINK, true);
- }
-
- /**
* Tests that WebappActivities handle window.open() properly in tabbed mode.
*/
- @CommandLineFlags.Add(ChromeSwitches.DISABLE_DOCUMENT_MODE)
@MediumTest
public void testWebappHandlesWindowOpenInTabbedMode() throws Exception {
triggerWindowOpenAndWaitForLoad(ChromeTabbedActivity.class, ONCLICK_LINK, true);
}
/**
- * Tests that WebappActivities handle suppressed window.open() properly in document mode.
- */
- @MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP)
- @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
- @DisabledTest
- public void testWebappHandlesSuppressedWindowOpenInDocumentMode() throws Exception {
- triggerWindowOpenAndWaitForDocumentLoad(HREF_NO_REFERRER_LINK, false);
- }
-
- /**
* Tests that WebappActivities handle suppressed window.open() properly in tabbed mode.
*/
- @CommandLineFlags.Add(ChromeSwitches.DISABLE_DOCUMENT_MODE)
@MediumTest
public void testWebappHandlesSuppressedWindowOpenInTabbedMode() throws Exception {
triggerWindowOpenAndWaitForLoad(ChromeTabbedActivity.class, HREF_NO_REFERRER_LINK, false);
}
- private void triggerWindowOpenAndWaitForDocumentLoad(
- String linkHtml, boolean checkContents) throws Exception {
- // We default to tabbed mode. To have the WebappActivity launch a DocumentActivity,
- // we have to explicitly override that default here.
- DocumentModeManager documentModeManager = DocumentModeManager.getInstance(
- getInstrumentation().getTargetContext());
- boolean previouslyOptedOut = documentModeManager.isOptedOutOfDocumentMode();
- documentModeManager.setOptedOutState(DocumentModeManager.OPT_OUT_PROMO_DISMISSED);
- try {
- triggerWindowOpenAndWaitForLoad(DocumentActivity.class, linkHtml, checkContents);
- } finally {
- if (previouslyOptedOut) {
- documentModeManager.setOptedOutState(
- DocumentModeManager.OPTED_OUT_OF_DOCUMENT_MODE);
- }
- }
- }
-
private <T extends ChromeActivity> void triggerWindowOpenAndWaitForLoad(
Class<T> classToWaitFor, String linkHtml, boolean checkContents) throws Exception {
final WebappActivity firstActivity =

Powered by Google App Engine
This is Rietveld 408576698