Improve hard-coded QuicSimpleServerStream's push promise id.

In IETF world, HTTP/3 static unidirectional streams are not guaranteed to be created at initialization. So we need to explicitly adjust highest_push_promise_id_ when a new H/3 static stream is created.

gfe-relnote: v99 change only, not protected.
PiperOrigin-RevId: 262976660
Change-Id: I3182356ae6560486b5677abdc73846f452598b24
diff --git a/quic/tools/quic_simple_server_session.cc b/quic/tools/quic_simple_server_session.cc
index 8f7dcf8..cf2c569 100644
--- a/quic/tools/quic_simple_server_session.cc
+++ b/quic/tools/quic_simple_server_session.cc
@@ -33,11 +33,7 @@
                             crypto_config,
                             compressed_certs_cache),
       highest_promised_stream_id_(
-          VersionHasStreamType(connection->transport_version())
-              ? QuicUtils::GetFirstUnidirectionalStreamId(
-                    connection->transport_version(),
-                    Perspective::IS_SERVER)
-              : QuicUtils::GetInvalidStreamId(connection->transport_version())),
+          QuicUtils::GetInvalidStreamId(connection->transport_version())),
       quic_simple_server_backend_(quic_simple_server_backend) {
   DCHECK(quic_simple_server_backend_);
 }
@@ -238,4 +234,14 @@
     HandlePromisedPushRequests();
   }
 }
+
+void QuicSimpleServerSession::MaybeInitializeHttp3UnidirectionalStreams() {
+  size_t previous_static_stream_count = num_outgoing_static_streams();
+  QuicSpdySession::MaybeInitializeHttp3UnidirectionalStreams();
+  size_t current_static_stream_count = num_outgoing_static_streams();
+  DCHECK_GE(current_static_stream_count, previous_static_stream_count);
+  highest_promised_stream_id_ +=
+      QuicUtils::StreamIdDelta(transport_version()) *
+      (current_static_stream_count - previous_static_stream_count);
+}
 }  // namespace quic