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

Unified Diff: net/base/upload_data_stream_unittest.cc

Issue 10388221: Revert 138168 - net: Fix a regression that broke file uploading with http authentication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/upload_data.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/upload_data_stream_unittest.cc
===================================================================
--- net/base/upload_data_stream_unittest.cc (revision 138174)
+++ net/base/upload_data_stream_unittest.cc (working copy)
@@ -27,17 +27,6 @@
const size_t kTestDataSize = arraysize(kTestData) - 1;
const size_t kTestBufferSize = 1 << 14; // 16KB.
-// Reads data from the upload data stream, and returns the data as string.
-std::string ReadFromUploadDataStream(UploadDataStream* stream) {
- std::string data_read;
- scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize);
- while (!stream->IsEOF()) {
- const int bytes_read = stream->Read(buf, kTestBufferSize);
- data_read.append(buf->data(), bytes_read);
- }
- return data_read;
-}
-
} // namespace
class UploadDataStreamTest : public PlatformTest {
@@ -155,36 +144,4 @@
file_util::Delete(temp_file_path, false);
}
-TEST_F(UploadDataStreamTest, UploadDataReused) {
- FilePath temp_file_path;
- ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file_path));
- ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
-
- // Prepare |upload_data_| that contains a file.
- std::vector<UploadData::Element> elements;
- UploadData::Element element;
- element.SetToFilePath(temp_file_path);
- elements.push_back(element);
- upload_data_->SetElements(elements);
- EXPECT_EQ(kTestDataSize, upload_data_->GetContentLengthSync());
-
- // Confirm that the file is read properly.
- {
- UploadDataStream stream(upload_data_);
- ASSERT_EQ(OK, stream.Init());
- EXPECT_EQ(kTestData, ReadFromUploadDataStream(&stream));
- }
-
- // Reuse |upload_data_| for another UploadDataStream, and confirm that the
- // file is read properly.
- {
- UploadDataStream stream(upload_data_);
- ASSERT_EQ(OK, stream.Init());
- EXPECT_EQ(kTestData, ReadFromUploadDataStream(&stream));
- }
-
- file_util::Delete(temp_file_path, false);
-}
-
} // namespace net
« no previous file with comments | « net/base/upload_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698