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

Unified Diff: content/child/web_url_loader_impl_unittest.cc

Issue 2274953003: Add a WebURLLoaderImplTest for a redirect response with no security info (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/web_url_loader_impl_unittest.cc
diff --git a/content/child/web_url_loader_impl_unittest.cc b/content/child/web_url_loader_impl_unittest.cc
index b5340f5002c90b633f13014c4dd9e20aca67ad15..b51cc72d0d39c2be2818e5a713f6d917607dc79f 100644
--- a/content/child/web_url_loader_impl_unittest.cc
+++ b/content/child/web_url_loader_impl_unittest.cc
@@ -44,6 +44,7 @@ namespace content {
namespace {
const char kTestURL[] = "http://foo";
+const char kTestHTTPSURL[] = "https://foo";
const char kTestData[] = "blah!";
const char kFtpDirMimeType[] = "text/vnd.chromium.ftp-dir";
@@ -309,6 +310,18 @@ class WebURLLoaderImplTest : public testing::Test {
EXPECT_TRUE(client()->did_receive_redirect());
}
+ void DoReceiveHTTPSRedirect() {
+ EXPECT_FALSE(client()->did_receive_redirect());
+ net::RedirectInfo redirect_info;
+ redirect_info.status_code = 302;
+ redirect_info.new_method = "GET";
+ redirect_info.new_url = GURL(kTestHTTPSURL);
+ redirect_info.new_first_party_for_cookies = GURL(kTestHTTPSURL);
+ peer()->OnReceivedRedirect(redirect_info,
+ content::ResourceResponseInfo());
+ EXPECT_TRUE(client()->did_receive_redirect());
+ }
+
void DoReceiveResponse() {
EXPECT_FALSE(client()->did_receive_response());
peer()->OnReceivedResponse(content::ResourceResponseInfo());
@@ -389,6 +402,18 @@ TEST_F(WebURLLoaderImplTest, Redirect) {
EXPECT_EQ(kTestData, client()->received_data());
}
+// Tests that a redirect to an HTTPS URL with no security info does not
+// crash. Regression test for https://crbug.com/519120
+TEST_F(WebURLLoaderImplTest, RedirectToHTTPSWithEmptySecurityInfo) {
+ DoStartAsyncRequest();
+ DoReceiveHTTPSRedirect();
+ DoReceiveResponse();
+ DoReceiveData();
+ DoCompleteRequest();
+ EXPECT_FALSE(dispatcher()->canceled());
+ EXPECT_EQ(kTestData, client()->received_data());
+}
+
TEST_F(WebURLLoaderImplTest, RedirectCorrectPriority) {
DoStartAsyncRequestWithPriority(
blink::WebURLRequest::Priority::PriorityVeryHigh);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698