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 7843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7854 EXPECT_EQ(OK, rv); | 7854 EXPECT_EQ(OK, rv); |
7855 EXPECT_EQ("hello world", response_data); | 7855 EXPECT_EQ("hello world", response_data); |
7856 | 7856 |
7857 base::DeleteFile(temp_file_path, false); | 7857 base::DeleteFile(temp_file_path, false); |
7858 } | 7858 } |
7859 | 7859 |
7860 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { | 7860 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { |
7861 base::FilePath temp_file; | 7861 base::FilePath temp_file; |
7862 ASSERT_TRUE(base::CreateTemporaryFile(&temp_file)); | 7862 ASSERT_TRUE(base::CreateTemporaryFile(&temp_file)); |
7863 std::string temp_file_content("Unreadable file."); | 7863 std::string temp_file_content("Unreadable file."); |
7864 ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_content.c_str(), | 7864 ASSERT_TRUE(base::WriteFile(temp_file, temp_file_content.c_str(), |
7865 temp_file_content.length())); | 7865 temp_file_content.length())); |
7866 ASSERT_TRUE(file_util::MakeFileUnreadable(temp_file)); | 7866 ASSERT_TRUE(file_util::MakeFileUnreadable(temp_file)); |
7867 | 7867 |
7868 ScopedVector<UploadElementReader> element_readers; | 7868 ScopedVector<UploadElementReader> element_readers; |
7869 element_readers.push_back( | 7869 element_readers.push_back( |
7870 new UploadFileElementReader(base::MessageLoopProxy::current().get(), | 7870 new UploadFileElementReader(base::MessageLoopProxy::current().get(), |
7871 temp_file, | 7871 temp_file, |
7872 0, | 7872 0, |
7873 kuint64max, | 7873 kuint64max, |
7874 base::Time())); | 7874 base::Time())); |
(...skipping 4559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12434 // established, to let the HTTP request start. | 12434 // established, to let the HTTP request start. |
12435 ASSERT_EQ(OK, http_callback.WaitForResult()); | 12435 ASSERT_EQ(OK, http_callback.WaitForResult()); |
12436 std::string response_data; | 12436 std::string response_data; |
12437 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); | 12437 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); |
12438 EXPECT_EQ("falafel", response_data); | 12438 EXPECT_EQ("falafel", response_data); |
12439 | 12439 |
12440 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); | 12440 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); |
12441 } | 12441 } |
12442 | 12442 |
12443 } // namespace net | 12443 } // namespace net |
OLD | NEW |