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

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

Issue 2077353002: [TEST ONLY] Run tests for 2030353002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: upload read error Created 4 years, 6 months 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/upload_data_stream.cc ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 9666 matching lines...) Expand 10 before | Expand all | Expand 10 after
9677 }; 9677 };
9678 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); 9678 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0);
9679 session_deps_.socket_factory->AddSocketDataProvider(&data); 9679 session_deps_.socket_factory->AddSocketDataProvider(&data);
9680 9680
9681 TestCompletionCallback callback; 9681 TestCompletionCallback callback;
9682 9682
9683 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); 9683 int rv = trans->Start(&request, callback.callback(), BoundNetLog());
9684 EXPECT_EQ(ERR_IO_PENDING, rv); 9684 EXPECT_EQ(ERR_IO_PENDING, rv);
9685 9685
9686 rv = callback.WaitForResult(); 9686 rv = callback.WaitForResult();
9687 EXPECT_EQ(OK, rv); 9687 EXPECT_EQ(ERR_UPLOAD_FILE_CHANGED, rv);
9688 9688
9689 const HttpResponseInfo* response = trans->GetResponseInfo(); 9689 const HttpResponseInfo* response = trans->GetResponseInfo();
9690 ASSERT_TRUE(response); 9690 ASSERT_TRUE(response);
9691 9691
9692 EXPECT_TRUE(response->headers); 9692 EXPECT_FALSE(response->headers);
9693 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine());
9694 9693
9695 std::string response_data; 9694 std::string response_data;
9696 rv = ReadTransaction(trans.get(), &response_data); 9695 rv = ReadTransaction(trans.get(), &response_data);
9697 EXPECT_EQ(OK, rv); 9696 EXPECT_EQ(OK, rv);
9698 EXPECT_EQ("hello world", response_data); 9697 EXPECT_EQ("HTTP/1.0 200 OK\r\n\r\nhello world", response_data);
9699 9698
9700 base::DeleteFile(temp_file_path, false); 9699 base::DeleteFile(temp_file_path, false);
9701 } 9700 }
9702 9701
9703 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { 9702 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) {
9704 base::FilePath temp_file; 9703 base::FilePath temp_file;
9705 ASSERT_TRUE(base::CreateTemporaryFile(&temp_file)); 9704 ASSERT_TRUE(base::CreateTemporaryFile(&temp_file));
9706 std::string temp_file_content("Unreadable file."); 9705 std::string temp_file_content("Unreadable file.");
9707 ASSERT_TRUE(base::WriteFile(temp_file, temp_file_content.c_str(), 9706 ASSERT_TRUE(base::WriteFile(temp_file, temp_file_content.c_str(),
9708 temp_file_content.length())); 9707 temp_file_content.length()));
(...skipping 6435 matching lines...) Expand 10 before | Expand all | Expand 10 after
16144 base::RunLoop().RunUntilIdle(); 16143 base::RunLoop().RunUntilIdle();
16145 16144
16146 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); 16145 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy);
16147 HttpRequestHeaders headers; 16146 HttpRequestHeaders headers;
16148 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); 16147 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers));
16149 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); 16148 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding));
16150 } 16149 }
16151 #endif // !defined(OS_IOS) 16150 #endif // !defined(OS_IOS)
16152 16151
16153 } // namespace net 16152 } // namespace net
OLDNEW
« no previous file with comments | « net/base/upload_data_stream.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698