| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); | 839 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); |
| 840 EXPECT_EQ("text/html; charset=ISO-8859-1", header); | 840 EXPECT_EQ("text/html; charset=ISO-8859-1", header); |
| 841 | 841 |
| 842 // The response has two "X-Multiple-Entries" headers. | 842 // The response has two "X-Multiple-Entries" headers. |
| 843 // This verfies our output has them concatenated together. | 843 // This verfies our output has them concatenated together. |
| 844 header.clear(); | 844 header.clear(); |
| 845 EXPECT_TRUE(headers->GetNormalizedHeader("x-multiple-entries", &header)); | 845 EXPECT_TRUE(headers->GetNormalizedHeader("x-multiple-entries", &header)); |
| 846 EXPECT_EQ("a, b", header); | 846 EXPECT_EQ("a, b", header); |
| 847 } | 847 } |
| 848 | 848 |
| 849 // TODO(jar): 14801 Remove BZIP code completely. | |
| 850 TEST_F(URLRequestTest, DISABLED_BZip2ContentTest) { | |
| 851 scoped_refptr<HTTPTestServer> server = | |
| 852 HTTPTestServer::CreateServer(L"net/data/filter_unittests", NULL); | |
| 853 ASSERT_TRUE(NULL != server.get()); | |
| 854 | |
| 855 // for localhost domain, we also should support bzip2 encoding | |
| 856 // first, get the original file | |
| 857 TestDelegate d1; | |
| 858 TestURLRequest req1(server->TestServerPage("realfiles/google.txt"), &d1); | |
| 859 req1.Start(); | |
| 860 MessageLoop::current()->Run(); | |
| 861 | |
| 862 const std::string& got_content = d1.data_received(); | |
| 863 | |
| 864 // second, get bzip2 content | |
| 865 TestDelegate d2; | |
| 866 TestURLRequest req2(server->TestServerPage("realbz2files/google.txt"), &d2); | |
| 867 req2.Start(); | |
| 868 MessageLoop::current()->Run(); | |
| 869 | |
| 870 const std::string& got_bz2_content = d2.data_received(); | |
| 871 | |
| 872 // compare those two results | |
| 873 EXPECT_EQ(got_content, got_bz2_content); | |
| 874 } | |
| 875 | |
| 876 // TODO(jar): 14801 Remove BZIP code completely. | |
| 877 TEST_F(URLRequestTest, DISABLED_BZip2ContentTest_IncrementalHeader) { | |
| 878 scoped_refptr<HTTPTestServer> server = | |
| 879 HTTPTestServer::CreateServer(L"net/data/filter_unittests", NULL); | |
| 880 ASSERT_TRUE(NULL != server.get()); | |
| 881 | |
| 882 // for localhost domain, we also should support bzip2 encoding | |
| 883 // first, get the original file | |
| 884 TestDelegate d1; | |
| 885 TestURLRequest req1(server->TestServerPage("realfiles/google.txt"), &d1); | |
| 886 req1.Start(); | |
| 887 MessageLoop::current()->Run(); | |
| 888 | |
| 889 const std::string& got_content = d1.data_received(); | |
| 890 | |
| 891 // second, get bzip2 content. ask the testserver to send the BZ2 header in | |
| 892 // two chunks with a delay between them. this tests our fix for bug 867161. | |
| 893 TestDelegate d2; | |
| 894 TestURLRequest req2(server->TestServerPage( | |
| 895 "realbz2files/google.txt?incremental-header"), &d2); | |
| 896 req2.Start(); | |
| 897 MessageLoop::current()->Run(); | |
| 898 | |
| 899 const std::string& got_bz2_content = d2.data_received(); | |
| 900 | |
| 901 // compare those two results | |
| 902 EXPECT_EQ(got_content, got_bz2_content); | |
| 903 } | |
| 904 | |
| 905 #if defined(OS_WIN) | 849 #if defined(OS_WIN) |
| 906 TEST_F(URLRequestTest, ResolveShortcutTest) { | 850 TEST_F(URLRequestTest, ResolveShortcutTest) { |
| 907 FilePath app_path; | 851 FilePath app_path; |
| 908 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); | 852 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); |
| 909 app_path = app_path.AppendASCII("net"); | 853 app_path = app_path.AppendASCII("net"); |
| 910 app_path = app_path.AppendASCII("data"); | 854 app_path = app_path.AppendASCII("data"); |
| 911 app_path = app_path.AppendASCII("url_request_unittest"); | 855 app_path = app_path.AppendASCII("url_request_unittest"); |
| 912 app_path = app_path.AppendASCII("with-headers.html"); | 856 app_path = app_path.AppendASCII("with-headers.html"); |
| 913 | 857 |
| 914 std::wstring lnk_path = app_path.value() + L".lnk"; | 858 std::wstring lnk_path = app_path.value() + L".lnk"; |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2221 ASSERT_TRUE(NULL != server_.get()); | 2165 ASSERT_TRUE(NULL != server_.get()); |
| 2222 TestDelegate d; | 2166 TestDelegate d; |
| 2223 TestURLRequest | 2167 TestURLRequest |
| 2224 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); | 2168 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); |
| 2225 req.set_context(new URLRequestTestContext()); | 2169 req.set_context(new URLRequestTestContext()); |
| 2226 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2170 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
| 2227 req.Start(); | 2171 req.Start(); |
| 2228 MessageLoop::current()->Run(); | 2172 MessageLoop::current()->Run(); |
| 2229 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2173 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
| 2230 } | 2174 } |
| OLD | NEW |