OLD | NEW |
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 6074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6085 EXPECT_EQ(OK, callback.WaitForResult()); | 6085 EXPECT_EQ(OK, callback.WaitForResult()); |
6086 | 6086 |
6087 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6087 const HttpResponseInfo* response = trans->GetResponseInfo(); |
6088 ASSERT_TRUE(response != NULL); | 6088 ASSERT_TRUE(response != NULL); |
6089 | 6089 |
6090 EXPECT_TRUE(response->headers != NULL); | 6090 EXPECT_TRUE(response->headers != NULL); |
6091 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); | 6091 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); |
6092 | 6092 |
6093 std::string response_data; | 6093 std::string response_data; |
6094 rv = ReadTransaction(trans.get(), &response_data); | 6094 rv = ReadTransaction(trans.get(), &response_data); |
6095 EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, rv); | 6095 EXPECT_EQ(ERR_CONNECTION_CLOSED, rv); |
6096 } | 6096 } |
6097 | 6097 |
6098 TEST_F(HttpNetworkTransactionTest, UploadFileSmallerThanLength) { | 6098 TEST_F(HttpNetworkTransactionTest, UploadFileSmallerThanLength) { |
6099 HttpRequestInfo request; | 6099 HttpRequestInfo request; |
6100 request.method = "POST"; | 6100 request.method = "POST"; |
6101 request.url = GURL("http://www.google.com/upload"); | 6101 request.url = GURL("http://www.google.com/upload"); |
6102 request.upload_data = new UploadData; | 6102 request.upload_data = new UploadData; |
6103 request.load_flags = 0; | 6103 request.load_flags = 0; |
6104 | 6104 |
6105 SessionDependencies session_deps; | 6105 SessionDependencies session_deps; |
(...skipping 3134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9240 StaticSocketDataProvider* data[] = { &data1, &data2 }; | 9240 StaticSocketDataProvider* data[] = { &data1, &data2 }; |
9241 | 9241 |
9242 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); | 9242 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); |
9243 | 9243 |
9244 EXPECT_EQ(OK, out.rv); | 9244 EXPECT_EQ(OK, out.rv); |
9245 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 9245 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
9246 EXPECT_EQ("hello world", out.response_data); | 9246 EXPECT_EQ("hello world", out.response_data); |
9247 } | 9247 } |
9248 | 9248 |
9249 } // namespace net | 9249 } // namespace net |
OLD | NEW |