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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 8863002: Revert 110505 - Report ERR_CONTENT_LENGTH_MISMATCH when the count of bytes received doesn't match... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | webkit/glue/weburlloader_impl.cc » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 // U - Uncompressed length. 874 // U - Uncompressed length.
875 // L - Large length (larger than both C & U). 875 // L - Large length (larger than both C & U).
876 // M - Medium length (between C & U). 876 // M - Medium length (between C & U).
877 // S - Small length (smaller than both C & U). 877 // S - Small length (smaller than both C & U).
878 const char test_parameters[] = "CULMS"; 878 const char test_parameters[] = "CULMS";
879 const int num_tests = arraysize(test_parameters)- 1; // Skip NULL. 879 const int num_tests = arraysize(test_parameters)- 1; // Skip NULL.
880 // C & U should be OK. 880 // C & U should be OK.
881 // L & M are larger than the data sent, and show an error. 881 // L & M are larger than the data sent, and show an error.
882 // S has too little data, but we seem to accept it. 882 // S has too little data, but we seem to accept it.
883 const bool test_expect_success[num_tests] = 883 const bool test_expect_success[num_tests] =
884 { true, false, false, false, true }; 884 { true, true, false, false, true };
885 885
886 for (int i = 0; i < num_tests ; i++) { 886 for (int i = 0; i < num_tests ; i++) {
887 TestDelegate d; 887 TestDelegate d;
888 { 888 {
889 std::string test_file = 889 std::string test_file =
890 base::StringPrintf("compressedfiles/BullRunSpeech.txt?%c", 890 base::StringPrintf("compressedfiles/BullRunSpeech.txt?%c",
891 test_parameters[i]); 891 test_parameters[i]);
892 892
893 TestNetworkDelegate network_delegate; // must outlive URLRequest 893 TestNetworkDelegate network_delegate; // must outlive URLRequest
894 scoped_refptr<TestURLRequestContext> context( 894 scoped_refptr<TestURLRequestContext> context(
(...skipping 11 matching lines...) Expand all
906 EXPECT_EQ(1, d.response_started_count()); 906 EXPECT_EQ(1, d.response_started_count());
907 EXPECT_FALSE(d.received_data_before_response()); 907 EXPECT_FALSE(d.received_data_before_response());
908 VLOG(1) << " Received " << d.bytes_received() << " bytes" 908 VLOG(1) << " Received " << d.bytes_received() << " bytes"
909 << " status = " << r.status().status() 909 << " status = " << r.status().status()
910 << " error = " << r.status().error(); 910 << " error = " << r.status().error();
911 if (test_expect_success[i]) { 911 if (test_expect_success[i]) {
912 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()) 912 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status())
913 << " Parameter = \"" << test_file << "\""; 913 << " Parameter = \"" << test_file << "\"";
914 } else { 914 } else {
915 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); 915 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status());
916 EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, r.status().error()) 916 EXPECT_EQ(-100, r.status().error())
917 << " Parameter = \"" << test_file << "\""; 917 << " Parameter = \"" << test_file << "\"";
918 } 918 }
919 } 919 }
920 } 920 }
921 } 921 }
922 922
923 // This test was disabled because it made chrome_frame_net_tests hang 923 // This test was disabled because it made chrome_frame_net_tests hang
924 // (see bug 102991). 924 // (see bug 102991).
925 TEST_F(URLRequestTestHTTP, DISABLED_HTTPSToHTTPRedirectNoRefererTest) { 925 TEST_F(URLRequestTestHTTP, DISABLED_HTTPSToHTTPRedirectNoRefererTest) {
926 ASSERT_TRUE(test_server_.Start()); 926 ASSERT_TRUE(test_server_.Start());
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 req.SetExtraRequestHeaders(headers); 3670 req.SetExtraRequestHeaders(headers);
3671 req.Start(); 3671 req.Start();
3672 MessageLoop::current()->Run(); 3672 MessageLoop::current()->Run();
3673 // If the net tests are being run with ChromeFrame then we need to allow for 3673 // If the net tests are being run with ChromeFrame then we need to allow for
3674 // the 'chromeframe' suffix which is added to the user agent before the 3674 // the 'chromeframe' suffix which is added to the user agent before the
3675 // closing parentheses. 3675 // closing parentheses.
3676 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); 3676 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true));
3677 } 3677 }
3678 3678
3679 } // namespace net 3679 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698