Use IETF application error codes for STOP_SENDING frames.

Add ietf_error_code member to QuicStopSendingFrame, and use
IetfResetStreamErrorCodeToRstStreamErrorCode() and
RstStreamErrorCodeToIetfResetStreamErrorCode() to convert to and from
QuicRstStreamErrorCode.  This closely mirrors behavior of QuicRstStreamFrame.

This is the reland of cl/330521460 with
EndToEndTests/EndToEndTest.ClientRstStats fixed.  See b/168041589 for flakiness
caused by original CL.  Locally verified that 100 runs pass both with and
without FLAGS_gfe2_reloadable_flag_quic_stop_sending_uses_ietf_error_code.

Protected by FLAGS_quic_reloadable_flag_quic_stop_sending_uses_application_error_code.

PiperOrigin-RevId: 331000553
Change-Id: Ie5ac10b4e75fe98858d1e79bd07c108525452caa
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 6012638..accb2a0 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -2278,8 +2278,15 @@
 
           QuicStopSendingFrame* stop_sending = frame.stop_sending_frame;
           EXPECT_EQ(stream_id, stop_sending->stream_id);
-          EXPECT_EQ(QuicHttp3ErrorCode::STREAM_CREATION_ERROR,
-                    static_cast<QuicHttp3ErrorCode>(stop_sending->error_code));
+          EXPECT_EQ(
+              GetQuicReloadableFlag(quic_stop_sending_uses_ietf_error_code)
+                  ? QUIC_STREAM_STREAM_CREATION_ERROR
+                  : static_cast<QuicRstStreamErrorCode>(
+                        QuicHttp3ErrorCode::STREAM_CREATION_ERROR),
+              stop_sending->error_code);
+          EXPECT_EQ(
+              static_cast<uint64_t>(QuicHttp3ErrorCode::STREAM_CREATION_ERROR),
+              stop_sending->ietf_error_code);
 
           return ClearControlFrame(frame);
         }));