| OLD | NEW |
| 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 <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 request.setURL(GURL("data:text/html;charset=utf-8,blah!")); | 500 request.setURL(GURL("data:text/html;charset=utf-8,blah!")); |
| 501 client()->set_delete_on_receive_data(); | 501 client()->set_delete_on_receive_data(); |
| 502 client()->loader()->loadAsynchronously(request, client()); | 502 client()->loader()->loadAsynchronously(request, client()); |
| 503 message_loop()->RunUntilIdle(); | 503 message_loop()->RunUntilIdle(); |
| 504 EXPECT_TRUE(client()->did_receive_response()); | 504 EXPECT_TRUE(client()->did_receive_response()); |
| 505 EXPECT_EQ("blah!", client()->received_data()); | 505 EXPECT_EQ("blah!", client()->received_data()); |
| 506 EXPECT_FALSE(client()->did_finish()); | 506 EXPECT_FALSE(client()->did_finish()); |
| 507 EXPECT_FALSE(bridge()); | 507 EXPECT_FALSE(bridge()); |
| 508 } | 508 } |
| 509 | 509 |
| 510 TEST_F(WebURLLoaderImplTest, DataURLDeleteOnFinish) { | 510 TEST_F(WebURLLoaderImplTest, DataURLDeleteOnFinisha) { |
| 511 blink::WebURLRequest request; | 511 blink::WebURLRequest request; |
| 512 request.initialize(); | 512 request.initialize(); |
| 513 request.setURL(GURL("data:text/html;charset=utf-8,blah!")); | 513 request.setURL(GURL("data:text/html;charset=utf-8,blah!")); |
| 514 client()->set_delete_on_finish(); | 514 client()->set_delete_on_finish(); |
| 515 client()->loader()->loadAsynchronously(request, client()); | 515 client()->loader()->loadAsynchronously(request, client()); |
| 516 message_loop()->RunUntilIdle(); | 516 message_loop()->RunUntilIdle(); |
| 517 EXPECT_TRUE(client()->did_receive_response()); | 517 EXPECT_TRUE(client()->did_receive_response()); |
| 518 EXPECT_EQ("blah!", client()->received_data()); | 518 EXPECT_EQ("blah!", client()->received_data()); |
| 519 EXPECT_TRUE(client()->did_finish()); | 519 EXPECT_TRUE(client()->did_finish()); |
| 520 EXPECT_FALSE(bridge()); | 520 EXPECT_FALSE(bridge()); |
| 521 } | 521 } |
| 522 | 522 |
| 523 TEST_F(WebURLLoaderImplTest, DataURLDefersLoading) { | |
| 524 blink::WebURLRequest request; | |
| 525 request.initialize(); | |
| 526 request.setURL(GURL("data:text/html;charset=utf-8,blah!")); | |
| 527 client()->loader()->loadAsynchronously(request, client()); | |
| 528 | |
| 529 client()->loader()->setDefersLoading(true); | |
| 530 message_loop()->RunUntilIdle(); | |
| 531 EXPECT_FALSE(client()->did_finish()); | |
| 532 | |
| 533 client()->loader()->setDefersLoading(false); | |
| 534 message_loop()->RunUntilIdle(); | |
| 535 EXPECT_TRUE(client()->did_finish()); | |
| 536 | |
| 537 EXPECT_EQ("blah!", client()->received_data()); | |
| 538 EXPECT_EQ(net::OK, client()->error().reason); | |
| 539 EXPECT_EQ("", client()->error().domain.utf8()); | |
| 540 } | |
| 541 | |
| 542 // FTP integration tests. These are focused more on safe deletion than correct | 523 // FTP integration tests. These are focused more on safe deletion than correct |
| 543 // parsing of FTP responses. | 524 // parsing of FTP responses. |
| 544 | 525 |
| 545 TEST_F(WebURLLoaderImplTest, Ftp) { | 526 TEST_F(WebURLLoaderImplTest, Ftp) { |
| 546 DoStartAsyncRequest(); | 527 DoStartAsyncRequest(); |
| 547 DoReceiveResponseFtp(); | 528 DoReceiveResponseFtp(); |
| 548 DoReceiveDataFtp(); | 529 DoReceiveDataFtp(); |
| 549 DoCompleteRequest(); | 530 DoCompleteRequest(); |
| 550 EXPECT_FALSE(bridge()->canceled()); | 531 EXPECT_FALSE(bridge()->canceled()); |
| 551 } | 532 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 EXPECT_EQ(kMimeType, client()->response().mimeType().latin1()); | 700 EXPECT_EQ(kMimeType, client()->response().mimeType().latin1()); |
| 720 | 701 |
| 721 DoReceiveData(); | 702 DoReceiveData(); |
| 722 DoCompleteRequest(); | 703 DoCompleteRequest(); |
| 723 EXPECT_FALSE(bridge()->canceled()); | 704 EXPECT_FALSE(bridge()->canceled()); |
| 724 EXPECT_EQ(kTestData, client()->received_data()); | 705 EXPECT_EQ(kTestData, client()->received_data()); |
| 725 } | 706 } |
| 726 | 707 |
| 727 } // namespace | 708 } // namespace |
| 728 } // namespace content | 709 } // namespace content |
| OLD | NEW |