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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 8496016: Report ERR_CONTENT_LENGTH_MISMATCH when the count of bytes received doesn't match Content-Length. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Clear error Created 9 years, 1 month 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 | « net/base/net_error_list.h ('k') | net/http/http_stream_parser.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 "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 6139 matching lines...) Expand 10 before | Expand all | Expand 10 after
6150 EXPECT_EQ(OK, callback.WaitForResult()); 6150 EXPECT_EQ(OK, callback.WaitForResult());
6151 6151
6152 const HttpResponseInfo* response = trans->GetResponseInfo(); 6152 const HttpResponseInfo* response = trans->GetResponseInfo();
6153 ASSERT_TRUE(response != NULL); 6153 ASSERT_TRUE(response != NULL);
6154 6154
6155 EXPECT_TRUE(response->headers != NULL); 6155 EXPECT_TRUE(response->headers != NULL);
6156 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); 6156 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine());
6157 6157
6158 std::string response_data; 6158 std::string response_data;
6159 rv = ReadTransaction(trans.get(), &response_data); 6159 rv = ReadTransaction(trans.get(), &response_data);
6160 EXPECT_EQ(ERR_CONNECTION_CLOSED, rv); 6160 EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, rv);
6161 } 6161 }
6162 6162
6163 TEST_F(HttpNetworkTransactionTest, UploadFileSmallerThanLength) { 6163 TEST_F(HttpNetworkTransactionTest, UploadFileSmallerThanLength) {
6164 HttpRequestInfo request; 6164 HttpRequestInfo request;
6165 request.method = "POST"; 6165 request.method = "POST";
6166 request.url = GURL("http://www.google.com/upload"); 6166 request.url = GURL("http://www.google.com/upload");
6167 request.upload_data = new UploadData; 6167 request.upload_data = new UploadData;
6168 request.load_flags = 0; 6168 request.load_flags = 0;
6169 6169
6170 SessionDependencies session_deps; 6170 SessionDependencies session_deps;
(...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after
9297 StaticSocketDataProvider* data[] = { &data1, &data2 }; 9297 StaticSocketDataProvider* data[] = { &data1, &data2 };
9298 9298
9299 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); 9299 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data));
9300 9300
9301 EXPECT_EQ(OK, out.rv); 9301 EXPECT_EQ(OK, out.rv);
9302 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); 9302 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line);
9303 EXPECT_EQ("hello world", out.response_data); 9303 EXPECT_EQ("hello world", out.response_data);
9304 } 9304 }
9305 9305
9306 } // namespace net 9306 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_error_list.h ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698