OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/url_request/url_request_unittest.h" | 5 #include "net/url_request/url_request_unittest.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); | 662 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); |
663 EXPECT_EQ("text/html; charset=ISO-8859-1", header); | 663 EXPECT_EQ("text/html; charset=ISO-8859-1", header); |
664 | 664 |
665 // The response has two "X-Multiple-Entries" headers. | 665 // The response has two "X-Multiple-Entries" headers. |
666 // This verfies our output has them concatenated together. | 666 // This verfies our output has them concatenated together. |
667 header.clear(); | 667 header.clear(); |
668 EXPECT_TRUE(headers->GetNormalizedHeader("x-multiple-entries", &header)); | 668 EXPECT_TRUE(headers->GetNormalizedHeader("x-multiple-entries", &header)); |
669 EXPECT_EQ("a, b", header); | 669 EXPECT_EQ("a, b", header); |
670 } | 670 } |
671 | 671 |
672 TEST_F(URLRequestTest, BZip2ContentTest) { | 672 // TODO(jar): 14801 Remove BZIP code completely. |
| 673 TEST_F(URLRequestTest, DISABLED_BZip2ContentTest) { |
673 scoped_refptr<HTTPTestServer> server = | 674 scoped_refptr<HTTPTestServer> server = |
674 HTTPTestServer::CreateServer(L"net/data/filter_unittests", NULL); | 675 HTTPTestServer::CreateServer(L"net/data/filter_unittests", NULL); |
675 ASSERT_TRUE(NULL != server.get()); | 676 ASSERT_TRUE(NULL != server.get()); |
676 | 677 |
677 // for localhost domain, we also should support bzip2 encoding | 678 // for localhost domain, we also should support bzip2 encoding |
678 // first, get the original file | 679 // first, get the original file |
679 TestDelegate d1; | 680 TestDelegate d1; |
680 TestURLRequest req1(server->TestServerPage("realfiles/google.txt"), &d1); | 681 TestURLRequest req1(server->TestServerPage("realfiles/google.txt"), &d1); |
681 req1.Start(); | 682 req1.Start(); |
682 MessageLoop::current()->Run(); | 683 MessageLoop::current()->Run(); |
683 | 684 |
684 const std::string& got_content = d1.data_received(); | 685 const std::string& got_content = d1.data_received(); |
685 | 686 |
686 // second, get bzip2 content | 687 // second, get bzip2 content |
687 TestDelegate d2; | 688 TestDelegate d2; |
688 TestURLRequest req2(server->TestServerPage("realbz2files/google.txt"), &d2); | 689 TestURLRequest req2(server->TestServerPage("realbz2files/google.txt"), &d2); |
689 req2.Start(); | 690 req2.Start(); |
690 MessageLoop::current()->Run(); | 691 MessageLoop::current()->Run(); |
691 | 692 |
692 const std::string& got_bz2_content = d2.data_received(); | 693 const std::string& got_bz2_content = d2.data_received(); |
693 | 694 |
694 // compare those two results | 695 // compare those two results |
695 EXPECT_EQ(got_content, got_bz2_content); | 696 EXPECT_EQ(got_content, got_bz2_content); |
696 } | 697 } |
697 | 698 |
698 TEST_F(URLRequestTest, BZip2ContentTest_IncrementalHeader) { | 699 // TODO(jar): 14801 Remove BZIP code completely. |
| 700 TEST_F(URLRequestTest, DISABLED_BZip2ContentTest_IncrementalHeader) { |
699 scoped_refptr<HTTPTestServer> server = | 701 scoped_refptr<HTTPTestServer> server = |
700 HTTPTestServer::CreateServer(L"net/data/filter_unittests", NULL); | 702 HTTPTestServer::CreateServer(L"net/data/filter_unittests", NULL); |
701 ASSERT_TRUE(NULL != server.get()); | 703 ASSERT_TRUE(NULL != server.get()); |
702 | 704 |
703 // for localhost domain, we also should support bzip2 encoding | 705 // for localhost domain, we also should support bzip2 encoding |
704 // first, get the original file | 706 // first, get the original file |
705 TestDelegate d1; | 707 TestDelegate d1; |
706 TestURLRequest req1(server->TestServerPage("realfiles/google.txt"), &d1); | 708 TestURLRequest req1(server->TestServerPage("realfiles/google.txt"), &d1); |
707 req1.Start(); | 709 req1.Start(); |
708 MessageLoop::current()->Run(); | 710 MessageLoop::current()->Run(); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 // Set headers (some of which are specific to the POST). | 1070 // Set headers (some of which are specific to the POST). |
1069 // ("Content-Length: 10" is just a junk value to make sure it gets stripped). | 1071 // ("Content-Length: 10" is just a junk value to make sure it gets stripped). |
1070 req.SetExtraRequestHeaders( | 1072 req.SetExtraRequestHeaders( |
1071 "Content-Type: multipart/form-data; " | 1073 "Content-Type: multipart/form-data; " |
1072 "boundary=----WebKitFormBoundaryAADeAA+NAAWMAAwZ\r\n" | 1074 "boundary=----WebKitFormBoundaryAADeAA+NAAWMAAwZ\r\n" |
1073 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9," | 1075 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9," |
1074 "text/plain;q=0.8,image/png,*/*;q=0.5\r\n" | 1076 "text/plain;q=0.8,image/png,*/*;q=0.5\r\n" |
1075 "Accept-Language: en-US,en\r\n" | 1077 "Accept-Language: en-US,en\r\n" |
1076 "Accept-Charset: ISO-8859-1,*,utf-8\r\n" | 1078 "Accept-Charset: ISO-8859-1,*,utf-8\r\n" |
1077 "Content-Length: 10\r\n" | 1079 "Content-Length: 10\r\n" |
1078 "Origin: http://localhost:1337/" | 1080 "Origin: http://localhost:1337/"); |
1079 ); | |
1080 req.Start(); | 1081 req.Start(); |
1081 MessageLoop::current()->Run(); | 1082 MessageLoop::current()->Run(); |
1082 | 1083 |
1083 std::string mime_type; | 1084 std::string mime_type; |
1084 req.GetMimeType(&mime_type); | 1085 req.GetMimeType(&mime_type); |
1085 EXPECT_EQ("text/html", mime_type); | 1086 EXPECT_EQ("text/html", mime_type); |
1086 | 1087 |
1087 const std::string& data = d.data_received(); | 1088 const std::string& data = d.data_received(); |
1088 | 1089 |
1089 // Check that the post-specific headers were stripped: | 1090 // Check that the post-specific headers were stripped: |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 | 1215 |
1215 int64 file_size = 0; | 1216 int64 file_size = 0; |
1216 file_util::GetFileSize(app_path, &file_size); | 1217 file_util::GetFileSize(app_path, &file_size); |
1217 | 1218 |
1218 EXPECT_TRUE(!r.is_pending()); | 1219 EXPECT_TRUE(!r.is_pending()); |
1219 EXPECT_EQ(1, d.response_started_count()); | 1220 EXPECT_EQ(1, d.response_started_count()); |
1220 EXPECT_FALSE(d.received_data_before_response()); | 1221 EXPECT_FALSE(d.received_data_before_response()); |
1221 EXPECT_EQ(d.bytes_received(), 0); | 1222 EXPECT_EQ(d.bytes_received(), 0); |
1222 } | 1223 } |
1223 } | 1224 } |
OLD | NEW |