| OLD | NEW |
| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 8132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8143 | 8143 |
| 8144 base::DeleteFile(temp_file_path, false); | 8144 base::DeleteFile(temp_file_path, false); |
| 8145 } | 8145 } |
| 8146 | 8146 |
| 8147 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { | 8147 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { |
| 8148 base::FilePath temp_file; | 8148 base::FilePath temp_file; |
| 8149 ASSERT_TRUE(base::CreateTemporaryFile(&temp_file)); | 8149 ASSERT_TRUE(base::CreateTemporaryFile(&temp_file)); |
| 8150 std::string temp_file_content("Unreadable file."); | 8150 std::string temp_file_content("Unreadable file."); |
| 8151 ASSERT_TRUE(base::WriteFile(temp_file, temp_file_content.c_str(), | 8151 ASSERT_TRUE(base::WriteFile(temp_file, temp_file_content.c_str(), |
| 8152 temp_file_content.length())); | 8152 temp_file_content.length())); |
| 8153 ASSERT_TRUE(file_util::MakeFileUnreadable(temp_file)); | 8153 ASSERT_TRUE(base::MakeFileUnreadable(temp_file)); |
| 8154 | 8154 |
| 8155 ScopedVector<UploadElementReader> element_readers; | 8155 ScopedVector<UploadElementReader> element_readers; |
| 8156 element_readers.push_back( | 8156 element_readers.push_back( |
| 8157 new UploadFileElementReader(base::MessageLoopProxy::current().get(), | 8157 new UploadFileElementReader(base::MessageLoopProxy::current().get(), |
| 8158 temp_file, | 8158 temp_file, |
| 8159 0, | 8159 0, |
| 8160 kuint64max, | 8160 kuint64max, |
| 8161 base::Time())); | 8161 base::Time())); |
| 8162 UploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8162 UploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8163 | 8163 |
| (...skipping 5041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13205 EXPECT_EQ(ERR_IO_PENDING, rv); | 13205 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 13206 | 13206 |
| 13207 rv = callback.WaitForResult(); | 13207 rv = callback.WaitForResult(); |
| 13208 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 13208 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 13209 | 13209 |
| 13210 const HttpResponseInfo* response = trans->GetResponseInfo(); | 13210 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 13211 EXPECT_TRUE(response == NULL); | 13211 EXPECT_TRUE(response == NULL); |
| 13212 } | 13212 } |
| 13213 | 13213 |
| 13214 } // namespace net | 13214 } // namespace net |
| OLD | NEW |