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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java

Issue 392113002: [android_webview] Support null AwWebResourceResponse headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « android_webview/java/src/org/chromium/android_webview/AwWebResourceResponse.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
index e1bcb59fbff68cbabf4c3b1686847cb21c992c8e..34c0511f30a46c4b725df919dc55f41777cfe5bd 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
@@ -465,6 +465,9 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase {
" return xhr.getResponseHeader('" + headerName + "');" +
"})();";
String header = executeJavaScriptAndWaitForResult(awContents, contentsClient, syncGetJs);
+
+ if (header.equals("null"))
+ return null;
// JSON stringification applied by executeJavaScriptAndWaitForResult adds quotes
// around returned strings.
assertTrue(header.length() > 2);
@@ -516,6 +519,20 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase {
getHeaderValue(mAwContents, mContentsClient, syncGetUrl, clientResponseHeaderName));
}
+ @SmallTest
+ @Feature({"AndroidWebView"})
+ public void testNullHttpResponseHeaders() throws Throwable {
+ final String syncGetUrl = mWebServer.getResponseUrl("/intercept_me");
+ enableJavaScriptOnUiThread(mAwContents);
+
+ final String aboutPageUrl = addAboutPageToTestServer(mWebServer);
+ loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), aboutPageUrl);
+
+ mShouldInterceptRequestHelper.setReturnValue(
+ new AwWebResourceResponse("text/html", "UTF-8", null, 0, null, null));
+ assertEquals(null, getHeaderValue(mAwContents, mContentsClient, syncGetUrl, "Some-Header"));
+ }
+
private String makePageWithTitle(String title) {
return CommonResources.makeHtmlPageFrom("<title>" + title + "</title>",
"<div> The title is: " + title + " </div>");
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwWebResourceResponse.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698