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

Unified Diff: components/cronet/ios/test/cronet_bidirectional_stream_test.mm

Issue 2371053003: [Cronet] Delete bidi stream asynchronously in OnFailed and MaybeOnSucceeded callbacks on iOS. (Closed)
Patch Set: Address Andrei's comments. Created 4 years, 3 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 | « components/cronet/ios/cronet_c_for_grpc.cc ('k') | components/cronet/tools/cr_cronet.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 836fac606f234d76968ee608b7878a6f6692f800..f55c86ceb8e9eb4e9dd4b6e790cec4428158e269 100644
--- a/components/cronet/ios/test/cronet_bidirectional_stream_test.mm
+++ b/components/cronet/ios/test/cronet_bidirectional_stream_test.mm
@@ -630,6 +630,36 @@ TEST_P(CronetBidirectionalStreamTest, WriteFailsBeforeRequestStarted) {
cronet_bidirectional_stream_destroy(test.stream);
}
+TEST_P(CronetBidirectionalStreamTest, StreamFailAfterStreamReadyCallback) {
+ class CustomTestBidirectionalStreamCallback
+ : public TestBidirectionalStreamCallback {
+ bool MaybeCancel(cronet_bidirectional_stream* stream,
+ ResponseStep step) override {
+ if (step == ResponseStep::ON_STREAM_READY) {
+ // Shut down the server, and the stream should error out.
+ // The second call to ShutdownQuicTestServer is no-op.
+ ShutdownQuicTestServer();
+ }
+ return TestBidirectionalStreamCallback::MaybeCancel(stream, step);
+ }
+ };
+
+ CustomTestBidirectionalStreamCallback test;
+ test.AddWriteData("Test String");
+ 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, "POST",
+ &kTestHeadersArray, false);
+ test.BlockForDone();
+ ASSERT_EQ(TestBidirectionalStreamCallback::ON_FAILED, test.response_step);
+ ASSERT_TRUE(test.net_error == net::ERR_QUIC_PROTOCOL_ERROR ||
+ test.net_error == net::ERR_QUIC_HANDSHAKE_FAILED);
+ cronet_bidirectional_stream_destroy(test.stream);
+}
+
TEST_P(CronetBidirectionalStreamTest,
StreamFailBeforeWriteIsExecutedOnNetworkThread) {
class CustomTestBidirectionalStreamCallback
« no previous file with comments | « components/cronet/ios/cronet_c_for_grpc.cc ('k') | components/cronet/tools/cr_cronet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698