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

Side by Side Diff: content/child/web_url_loader_impl_unittest.cc

Issue 2315443003: Stop sending serialized SSLStatus to the renderer. (Closed)
Patch Set: self review fix and merge fix Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 void DoReceiveData() { 332 void DoReceiveData() {
333 EXPECT_EQ("", client()->received_data()); 333 EXPECT_EQ("", client()->received_data());
334 auto size = strlen(kTestData); 334 auto size = strlen(kTestData);
335 peer()->OnReceivedData( 335 peer()->OnReceivedData(
336 base::MakeUnique<FixedReceivedData>(kTestData, size, size, size)); 336 base::MakeUnique<FixedReceivedData>(kTestData, size, size, size));
337 EXPECT_EQ(kTestData, client()->received_data()); 337 EXPECT_EQ(kTestData, client()->received_data());
338 } 338 }
339 339
340 void DoCompleteRequest() { 340 void DoCompleteRequest() {
341 EXPECT_FALSE(client()->did_finish()); 341 EXPECT_FALSE(client()->did_finish());
342 peer()->OnCompletedRequest(net::OK, false, false, "", base::TimeTicks(), 342 peer()->OnCompletedRequest(net::OK, false, false, base::TimeTicks(),
343 strlen(kTestData)); 343 strlen(kTestData));
344 EXPECT_TRUE(client()->did_finish()); 344 EXPECT_TRUE(client()->did_finish());
345 // There should be no error. 345 // There should be no error.
346 EXPECT_EQ(net::OK, client()->error().reason); 346 EXPECT_EQ(net::OK, client()->error().reason);
347 EXPECT_EQ("", client()->error().domain.utf8()); 347 EXPECT_EQ("", client()->error().domain.utf8());
348 } 348 }
349 349
350 void DoFailRequest() { 350 void DoFailRequest() {
351 EXPECT_FALSE(client()->did_finish()); 351 EXPECT_FALSE(client()->did_finish());
352 peer()->OnCompletedRequest(net::ERR_FAILED, false, false, "", 352 peer()->OnCompletedRequest(net::ERR_FAILED, false, false,
353 base::TimeTicks(), strlen(kTestData)); 353 base::TimeTicks(), strlen(kTestData));
354 EXPECT_FALSE(client()->did_finish()); 354 EXPECT_FALSE(client()->did_finish());
355 EXPECT_EQ(net::ERR_FAILED, client()->error().reason); 355 EXPECT_EQ(net::ERR_FAILED, client()->error().reason);
356 EXPECT_EQ(net::kErrorDomain, client()->error().domain.utf8()); 356 EXPECT_EQ(net::kErrorDomain, client()->error().domain.utf8());
357 } 357 }
358 358
359 void DoReceiveResponseFtp() { 359 void DoReceiveResponseFtp() {
360 EXPECT_FALSE(client()->did_receive_response()); 360 EXPECT_FALSE(client()->did_receive_response());
361 content::ResourceResponseInfo response_info; 361 content::ResourceResponseInfo response_info;
362 response_info.mime_type = kFtpDirMimeType; 362 response_info.mime_type = kFtpDirMimeType;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 TEST_F(WebURLLoaderImplTest, Redirect) { 395 TEST_F(WebURLLoaderImplTest, Redirect) {
396 DoStartAsyncRequest(); 396 DoStartAsyncRequest();
397 DoReceiveRedirect(); 397 DoReceiveRedirect();
398 DoReceiveResponse(); 398 DoReceiveResponse();
399 DoReceiveData(); 399 DoReceiveData();
400 DoCompleteRequest(); 400 DoCompleteRequest();
401 EXPECT_FALSE(dispatcher()->canceled()); 401 EXPECT_FALSE(dispatcher()->canceled());
402 EXPECT_EQ(kTestData, client()->received_data()); 402 EXPECT_EQ(kTestData, client()->received_data());
403 } 403 }
404 404
405 // Tests that a redirect to an HTTPS URL with no security info does not
406 // crash. Regression test for https://crbug.com/519120
407 TEST_F(WebURLLoaderImplTest, RedirectToHTTPSWithEmptySecurityInfo) {
408 DoStartAsyncRequest();
409 DoReceiveHTTPSRedirect();
410 DoReceiveResponse();
411 DoReceiveData();
412 DoCompleteRequest();
413 EXPECT_FALSE(dispatcher()->canceled());
414 EXPECT_EQ(kTestData, client()->received_data());
415 }
416
417 TEST_F(WebURLLoaderImplTest, RedirectCorrectPriority) { 405 TEST_F(WebURLLoaderImplTest, RedirectCorrectPriority) {
418 DoStartAsyncRequestWithPriority( 406 DoStartAsyncRequestWithPriority(
419 blink::WebURLRequest::Priority::PriorityVeryHigh); 407 blink::WebURLRequest::Priority::PriorityVeryHigh);
420 client()->set_redirect_request_priority( 408 client()->set_redirect_request_priority(
421 blink::WebURLRequest::Priority::PriorityVeryHigh); 409 blink::WebURLRequest::Priority::PriorityVeryHigh);
422 DoReceiveRedirect(); 410 DoReceiveRedirect();
423 DoReceiveResponse(); 411 DoReceiveResponse();
424 DoReceiveData(); 412 DoReceiveData();
425 DoCompleteRequest(); 413 DoCompleteRequest();
426 EXPECT_FALSE(dispatcher()->canceled()); 414 EXPECT_FALSE(dispatcher()->canceled());
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 588 }
601 589
602 TEST_F(WebURLLoaderImplTest, FtpDeleteOnReceiveMoreData) { 590 TEST_F(WebURLLoaderImplTest, FtpDeleteOnReceiveMoreData) {
603 DoStartAsyncRequest(); 591 DoStartAsyncRequest();
604 DoReceiveResponseFtp(); 592 DoReceiveResponseFtp();
605 DoReceiveDataFtp(); 593 DoReceiveDataFtp();
606 594
607 // Directory listings are only parsed once the request completes, so this will 595 // Directory listings are only parsed once the request completes, so this will
608 // cancel in DoReceiveDataFtp, before the request finishes. 596 // cancel in DoReceiveDataFtp, before the request finishes.
609 client()->set_delete_on_receive_data(); 597 client()->set_delete_on_receive_data();
610 peer()->OnCompletedRequest(net::OK, false, false, "", base::TimeTicks(), 598 peer()->OnCompletedRequest(net::OK, false, false, base::TimeTicks(),
611 strlen(kTestData)); 599 strlen(kTestData));
612 EXPECT_FALSE(client()->did_finish()); 600 EXPECT_FALSE(client()->did_finish());
613 } 601 }
614 602
615 TEST_F(WebURLLoaderImplTest, FtpDeleteOnFinish) { 603 TEST_F(WebURLLoaderImplTest, FtpDeleteOnFinish) {
616 client()->set_delete_on_finish(); 604 client()->set_delete_on_finish();
617 DoStartAsyncRequest(); 605 DoStartAsyncRequest();
618 DoReceiveResponseFtp(); 606 DoReceiveResponseFtp();
619 DoReceiveDataFtp(); 607 DoReceiveDataFtp();
620 DoCompleteRequest(); 608 DoCompleteRequest();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 encoded_data_length); 711 encoded_data_length);
724 712
725 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength()); 713 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength());
726 EXPECT_EQ(kEncodedDataLength, encoded_data_length); 714 EXPECT_EQ(kEncodedDataLength, encoded_data_length);
727 int expected_decoded_body_length = strlen(kBodyData); 715 int expected_decoded_body_length = strlen(kBodyData);
728 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength()); 716 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength());
729 } 717 }
730 718
731 } // namespace 719 } // namespace
732 } // namespace content 720 } // namespace content
OLDNEW
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698