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 "content/browser/loader/upload_data_stream_builder.h" | 5 #include "content/browser/loader/upload_data_stream_builder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const net::UploadFileElementReader* r2 = | 74 const net::UploadFileElementReader* r2 = |
75 (*upload->GetElementReaders())[1]->AsFileReader(); | 75 (*upload->GetElementReaders())[1]->AsFileReader(); |
76 ASSERT_TRUE(r2); | 76 ASSERT_TRUE(r2); |
77 EXPECT_EQ(kFilePath, r2->path().value()); | 77 EXPECT_EQ(kFilePath, r2->path().value()); |
78 EXPECT_EQ(kFileOffset, r2->range_offset()); | 78 EXPECT_EQ(kFileOffset, r2->range_offset()); |
79 EXPECT_EQ(kFileLength, r2->range_length()); | 79 EXPECT_EQ(kFileLength, r2->range_length()); |
80 EXPECT_EQ(kFileTime, r2->expected_modification_time()); | 80 EXPECT_EQ(kFileTime, r2->expected_modification_time()); |
81 | 81 |
82 const storage::UploadBlobElementReader* r3 = | 82 const storage::UploadBlobElementReader* r3 = |
83 static_cast<storage::UploadBlobElementReader*>( | 83 static_cast<storage::UploadBlobElementReader*>( |
84 (*upload->GetElementReaders())[2]); | 84 (*upload->GetElementReaders())[2].get()); |
85 ASSERT_TRUE(r3); | 85 ASSERT_TRUE(r3); |
86 EXPECT_EQ("blobuuid", r3->uuid()); | 86 EXPECT_EQ("blobuuid", r3->uuid()); |
87 } | 87 } |
88 // Clean up for ASAN. | 88 // Clean up for ASAN. |
89 base::RunLoop().RunUntilIdle(); | 89 base::RunLoop().RunUntilIdle(); |
90 } | 90 } |
91 | 91 |
92 TEST(UploadDataStreamBuilderTest, | 92 TEST(UploadDataStreamBuilderTest, |
93 WriteUploadDataStreamWithEmptyFileBackedBlob) { | 93 WriteUploadDataStreamWithEmptyFileBackedBlob) { |
94 base::MessageLoopForIO message_loop; | 94 base::MessageLoopForIO message_loop; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 int result = | 143 int result = |
144 upload->Read(io_buffer.get(), kBufferLength, read_callback.callback()); | 144 upload->Read(io_buffer.get(), kBufferLength, read_callback.callback()); |
145 EXPECT_EQ(static_cast<int>(kZeroLength), read_callback.GetResult(result)); | 145 EXPECT_EQ(static_cast<int>(kZeroLength), read_callback.GetResult(result)); |
146 | 146 |
147 base::DeleteFile(test_blob_path, false); | 147 base::DeleteFile(test_blob_path, false); |
148 } | 148 } |
149 // Clean up for ASAN. | 149 // Clean up for ASAN. |
150 base::RunLoop().RunUntilIdle(); | 150 base::RunLoop().RunUntilIdle(); |
151 } | 151 } |
152 } // namespace content | 152 } // namespace content |
OLD | NEW |