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

Unified Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java

Issue 2827393003: Prevent Android tests from being broken by data URL deprecation (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
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java
index 248cbc47ef1ce152fe349ecd21278060d6ec3a63..e6f9f093b36edad1d695b7797955583904245717 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java
@@ -10,7 +10,6 @@ import android.text.TextUtils;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CommandLineFlags;
-import org.chromium.base.test.util.UrlUtils;
import org.chromium.base.test.util.parameter.BaseParameter;
import org.chromium.base.test.util.parameter.Parameter;
import org.chromium.base.test.util.parameter.Parameterizable;
@@ -38,98 +37,8 @@ import java.util.Map;
})
public abstract class MultiActivityTestBase extends InstrumentationTestCase
implements Parameterizable {
- protected static final String URL_1 = createTestUrl(1);
- protected static final String URL_2 = createTestUrl(2);
- protected static final String URL_3 = createTestUrl(3);
- protected static final String URL_4 = createTestUrl(4);
-
private Parameter.Reader mParameterReader;
private Map<String, BaseParameter> mAvailableParameters;
-
- /** Defines one gigantic link spanning the whole page that creates a new window with URL_4. */
- public static final String HREF_LINK = UrlUtils.encodeHtmlDataUri(
- "<html>"
- + " <head>"
- + " <title>href link page</title>"
- + " <meta name='viewport'"
- + " content='width=device-width initial-scale=0.5, maximum-scale=0.5'>"
- + " <style>"
- + " body {margin: 0em;} div {width: 100%; height: 100%; background: #011684;}"
- + " </style>"
- + " </head>"
- + " <body>"
- + " <a href='" + URL_4 + "' target='_blank'><div></div></a>"
- + " </body>"
- + "</html>");
-
- /** Same as HREF_LINK, but disallowing a referrer from being sent triggers another codepath. */
- protected static final String HREF_NO_REFERRER_LINK = UrlUtils.encodeHtmlDataUri(
- "<html>"
- + " <head>"
- + " <title>href no referrer link page</title>"
- + " <meta name='viewport'"
- + " content='width=device-width initial-scale=0.5, maximum-scale=0.5'>"
- + " <style>"
- + " body {margin: 0em;} div {width: 100%; height: 100%; background: #011684;}"
- + " </style>"
- + " </head>"
- + " <body>"
- + " <a href='" + URL_4 + "' target='_blank' rel='noreferrer'><div></div></a>"
- + " </body>"
- + "</html>");
-
- /** Clicking the body triggers a window.open() call to open URL_4. */
- protected static final String SUCCESS_URL = UrlUtils.encodeHtmlDataUri("opened!");
- protected static final String ONCLICK_LINK = UrlUtils.encodeHtmlDataUri(
- "<html>"
- + " <head>"
- + " <title>window.open page</title>"
- + " <meta name='viewport'"
- + " content='width=device-width initial-scale=0.5, maximum-scale=0.5'>"
- + " <style>"
- + " body {margin: 0em;} div {width: 100%; height: 100%; background: #011684;}"
- + " </style>"
- + " <script>"
- + " function openNewWindow() {"
- + " var site = window.open('" + URL_4 + "');"
- + " if (site) location.href = '" + SUCCESS_URL + "';"
- + " }"
- + " </script>"
- + " </head>"
- + " <body id='body'>"
- + " <div onclick='openNewWindow()'></div>"
- + " </body>"
- + "</html>");
-
- /** Opens a new page via window.open(), but get rid of the opener. */
- protected static final String ONCLICK_NO_REFERRER_LINK = UrlUtils.encodeHtmlDataUri(
- "<html>"
- + " <head>"
- + " <title>window.open page, opener set to null</title>"
- + " <meta name='viewport'"
- + " content='width=device-width initial-scale=0.5, maximum-scale=0.5'>"
- + " <style>"
- + " body {margin: 0em;} div {width: 100%; height: 100%; background: #011684;}"
- + " </style>"
- + " <script>"
- + " function openWithoutReferrer() {"
- + " var site = window.open();"
- + " site.opener = null;"
- + " site.document.open();"
- + " site.document.write("
- + " '<meta http-equiv=\"refresh\" content=\"0;url=" + URL_4 + "\">');"
- + " site.document.close();"
- + " if (site) location.href = '" + SUCCESS_URL + "';"
- + " }"
- + " </script>"
- + " </head>"
- + " <body>"
- + " <a onclick='openWithoutReferrer()'>"
- + " <div>The bug that just keeps on coming back.</div>"
- + " </a>"
- + " </body>"
- + "</html>");
-
protected MockStorageDelegate mStorageDelegate;
protected Context mContext;
@@ -243,17 +152,4 @@ public abstract class MultiActivityTestBase extends InstrumentationTestCase
protected Parameter.Reader getParameterReader() {
return mParameterReader;
}
-
- private static final String createTestUrl(int index) {
- String[] colors = {"#000000", "#ff0000", "#00ff00", "#0000ff", "#ffff00"};
- return UrlUtils.encodeHtmlDataUri(
- "<html>"
- + " <head>"
- + " <title>Page " + index + "</title>"
- + " <meta name='viewport' content='width=device-width "
- + " initial-scale=0.5 maximum-scale=0.5'>"
- + " </head>"
- + " <body style='margin: 0em; background: " + colors[index] + ";'></body>"
- + "</html>");
- }
}
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698