Chromium Code Reviews| Index: components/cronet/ios/test/cronet_bidirectional_stream_test.mm |
| diff --git a/components/cronet/ios/test/cronet_bidirectional_stream_test.mm b/components/cronet/ios/test/cronet_bidirectional_stream_test.mm |
| index 473103bae3dacaf6f93c2043e47dbb90d8069176..24506da09575b73d1591b1a70b9d1f19b9d73980 100644 |
| --- a/components/cronet/ios/test/cronet_bidirectional_stream_test.mm |
| +++ b/components/cronet/ios/test/cronet_bidirectional_stream_test.mm |
| @@ -326,6 +326,31 @@ TEST_P(CronetBidirectionalStreamTest, StartExampleBidiStream) { |
| cronet_bidirectional_stream_destroy(test.stream); |
| } |
| +TEST_P(CronetBidirectionalStreamTest, SimplePutWithEmptyWriteDataAtTheEnd) { |
| + TestBidirectionalStreamCallback test; |
| + test.AddWriteData("Hello, "); |
| + test.AddWriteData("world!"); |
| + test.AddWriteData(""); |
| + test.read_buffer_size = 2; |
|
xunjieli
2016/07/25 18:36:43
Could you add a comment on why we are using a read
mef
2016/07/26 19:26:24
Done. I've added comment to StartExampleBidiStream
|
| + test.stream = |
| + cronet_bidirectional_stream_create(engine(), &test, test.callback()); |
| + DCHECK(test.stream); |
| + cronet_bidirectional_stream_delay_request_headers_until_flush(test.stream, |
| + GetParam()); |
| + cronet_bidirectional_stream_start(test.stream, kTestServerUrl, 0, "PUT", |
| + &kTestHeadersArray, false); |
| + test.BlockForDone(); |
| + ASSERT_EQ(std::string(kHelloStatus), test.response_headers[kStatusHeader]); |
| + ASSERT_EQ(std::string(kHelloHeaderValue), |
| + test.response_headers[kHelloHeaderName]); |
| + ASSERT_EQ(TestBidirectionalStreamCallback::ON_SUCCEEDED, test.response_step); |
| + ASSERT_EQ(std::string(kHelloBodyValue, 2), test.read_data.front()); |
| + ASSERT_EQ(std::string(kHelloBodyValue), base::JoinString(test.read_data, "")); |
|
xunjieli
2016/07/25 18:36:43
Why do we need a concatenation of test.read_data w
mef
2016/07/26 19:26:24
The empty string is a separator between elements b
|
| + ASSERT_EQ(std::string(kHelloTrailerValue), |
| + test.response_trailers[kHelloTrailerName]); |
| + cronet_bidirectional_stream_destroy(test.stream); |
| +} |
| + |
| TEST_P(CronetBidirectionalStreamTest, SimpleGetWithFlush) { |
| TestBidirectionalStreamCallback test; |
| test.stream = |