summaryrefslogtreecommitdiffstats
path: root/net/test/android
diff options
context:
space:
mode:
authorcimamoglu@chromium.org <cimamoglu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 12:10:58 +0000
committercimamoglu@chromium.org <cimamoglu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 12:10:58 +0000
commit971b2e973f45bb207dcdb13fcd0b4e0020b89521 (patch)
tree7bf4e9f4dc466463df7a4a92516c617f18fad8af /net/test/android
parentfea004b7a18a24b8a41e58759195bc48475724b7 (diff)
downloadchromium_src-971b2e973f45bb207dcdb13fcd0b4e0020b89521.zip
chromium_src-971b2e973f45bb207dcdb13fcd0b4e0020b89521.tar.gz
chromium_src-971b2e973f45bb207dcdb13fcd0b4e0020b89521.tar.bz2
Do not attempt to download favicons with 404 status in WebView
This issue was fixed for Chromium (crbug.com/39402). This patch gets the relevant parts of the fixing patch for Android WebView. BUG=39402 Review URL: https://codereview.chromium.org/255503004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test/android')
-rw-r--r--net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java b/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
index 1971f71..0ef13ca 100644
--- a/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
+++ b/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
@@ -80,11 +80,13 @@ public class TestWebServer {
final List<Pair<String, String>> mResponseHeaders;
final boolean mIsRedirect;
final Runnable mResponseAction;
+ final boolean mIsNotFound;
- Response(byte[] resposneData, List<Pair<String, String>> responseHeaders,
- boolean isRedirect, Runnable responseAction) {
+ Response(byte[] responseData, List<Pair<String, String>> responseHeaders,
+ boolean isRedirect, boolean isNotFound, Runnable responseAction) {
mIsRedirect = isRedirect;
- mResponseData = resposneData;
+ mIsNotFound = isNotFound;
+ mResponseData = responseData;
mResponseHeaders = responseHeaders == null ?
new ArrayList<Pair<String, String>>() : responseHeaders;
mResponseAction = responseAction;
@@ -166,16 +168,18 @@ public class TestWebServer {
private static final int RESPONSE_STATUS_NORMAL = 0;
private static final int RESPONSE_STATUS_MOVED_TEMPORARILY = 1;
+ private static final int RESPONSE_STATUS_NOT_FOUND = 2;
private String setResponseInternal(
String requestPath, byte[] responseData,
List<Pair<String, String>> responseHeaders, Runnable responseAction,
int status) {
final boolean isRedirect = (status == RESPONSE_STATUS_MOVED_TEMPORARILY);
+ final boolean isNotFound = (status == RESPONSE_STATUS_NOT_FOUND);
synchronized (mLock) {
mResponseMap.put(requestPath, new Response(
- responseData, responseHeaders, isRedirect, responseAction));
+ responseData, responseHeaders, isRedirect, isNotFound, responseAction));
mResponseCountMap.put(requestPath, Integer.valueOf(0));
mLastRequestMap.put(requestPath, null);
}
@@ -195,6 +199,19 @@ public class TestWebServer {
}
/**
+ * Sets a 404 (not found) response to be returned when a particular request path is passed in.
+ *
+ * @param requestPath The path to respond to.
+ * @return The full URL including the path that should be requested to get the expected
+ * response.
+ */
+ public String setResponseWithNotFoundStatus(
+ String requestPath) {
+ return setResponseInternal(requestPath, "".getBytes(), null, null,
+ RESPONSE_STATUS_NOT_FOUND);
+ }
+
+ /**
* Sets a response to be returned when a particular request path is passed
* in (with the option to specify additional headers).
*
@@ -392,6 +409,9 @@ public class TestWebServer {
httpResponse = createResponse(HttpStatus.SC_OK);
} else if (response == null) {
httpResponse = createResponse(HttpStatus.SC_NOT_FOUND);
+ } else if (response.mIsNotFound) {
+ httpResponse = createResponse(HttpStatus.SC_NOT_FOUND);
+ servedResponseFor(path, request);
} else if (response.mIsRedirect) {
httpResponse = createResponse(HttpStatus.SC_MOVED_TEMPORARILY);
for (Pair<String, String> header : response.mResponseHeaders) {