Change default QuicStream priority when using IETF QUIC.

This allows removal of MaybeSendPriorityUpdateFrame() call in
QuicSpdyStream::WriteHeaders(): if priority is default, no need to send
PRIORITY_UPDATE; if SetPriority() has been called, then PRIORITY_UPDATE has
already been sent.

gfe-relnote: n/a, change to QUIC v99-only code.  Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99.
PiperOrigin-RevId: 292745471
Change-Id: Ic9fff95e6a1650a91449a659fbe156265f2b9cac
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 11c5fda..b813d43 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -2172,7 +2172,7 @@
   struct PriorityUpdateFrame priority_update1;
   priority_update1.prioritized_element_type = REQUEST_STREAM;
   priority_update1.prioritized_element_id = stream_id1;
-  priority_update1.priority_field_value = "u=1";
+  priority_update1.priority_field_value = "u=2";
   std::string serialized_priority_update1 =
       SerializePriorityUpdateFrame(priority_update1);
   QuicStreamFrame data3(receive_control_stream_id,
@@ -2181,9 +2181,10 @@
 
   // PRIORITY_UPDATE frame arrives after stream creation.
   TestStream* stream1 = session_.CreateIncomingStream(stream_id1);
-  EXPECT_EQ(3u, stream1->precedence().spdy3_priority());
+  EXPECT_EQ(QuicStream::kDefaultUrgency,
+            stream1->precedence().spdy3_priority());
   session_.OnStreamFrame(data3);
-  EXPECT_EQ(1u, stream1->precedence().spdy3_priority());
+  EXPECT_EQ(2u, stream1->precedence().spdy3_priority());
 
   // PRIORITY_UPDATE frame for second request stream.
   const QuicStreamId stream_id2 = GetNthClientInitiatedBidirectionalId(1);
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index b393ee3..89748a9 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -281,8 +281,6 @@
                       false, nullptr);
   }
 
-  MaybeSendPriorityUpdateFrame();
-
   size_t bytes_written =
       WriteHeadersImpl(std::move(header_block), fin, std::move(ack_listener));
   if (!VersionUsesHttp3(transport_version()) && fin) {
diff --git a/quic/core/http/quic_spdy_stream.h b/quic/core/http/quic_spdy_stream.h
index c75a268..923ff7c 100644
--- a/quic/core/http/quic_spdy_stream.h
+++ b/quic/core/http/quic_spdy_stream.h
@@ -43,12 +43,6 @@
     : public QuicStream,
       public QpackDecodedHeadersAccumulator::Visitor {
  public:
-  // The default value of urgency when using the priority extension defined at
-  // https://httpwg.org/http-extensions/draft-ietf-httpbis-priority.html#default.
-  // This is not the default priority of a stream, rather the default priority a
-  // server thinks a stream has until it receives a PRIORITY_UPDATE frame.
-  static const int kDefaultUrgency = 1;
-
   // Visitor receives callbacks from the stream.
   class QUIC_EXPORT_PRIVATE Visitor {
    public:
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 5d0a162..9f7e894 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -1311,34 +1311,6 @@
   EXPECT_TRUE(stream_->fin_sent());
 }
 
-TEST_P(QuicSpdyStreamTest, SendPriorityUpdate) {
-  if (!UsesHttp3()) {
-    return;
-  }
-
-  InitializeWithPerspective(kShouldProcessData, Perspective::IS_CLIENT);
-
-  // Four writes on the request stream: HEADERS frame header and payload both
-  // for headers and trailers.
-  EXPECT_CALL(*session_, WritevData(stream_, stream_->id(), _, _, _)).Times(4);
-  // PRIORITY_UPDATE frame on the control stream.
-  auto send_control_stream =
-      QuicSpdySessionPeer::GetSendControlStream(session_.get());
-  EXPECT_CALL(*session_, WritevData(send_control_stream,
-                                    send_control_stream->id(), _, _, _));
-
-  // Write the initial headers, without a FIN.
-  EXPECT_CALL(*stream_, WriteHeadersMock(false));
-  stream_->WriteHeaders(SpdyHeaderBlock(), /*fin=*/false, nullptr);
-
-  // Writing trailers implicitly sends a FIN.
-  SpdyHeaderBlock trailers;
-  trailers["trailer key"] = "trailer value";
-  EXPECT_CALL(*stream_, WriteHeadersMock(true));
-  stream_->WriteTrailers(std::move(trailers), nullptr);
-  EXPECT_TRUE(stream_->fin_sent());
-}
-
 TEST_P(QuicSpdyStreamTest, DoNotSendPriorityUpdateWithDefaultUrgency) {
   if (!UsesHttp3()) {
     return;
@@ -1350,10 +1322,8 @@
   // for headers and trailers.
   EXPECT_CALL(*session_, WritevData(stream_, stream_->id(), _, _, _)).Times(4);
 
-  stream_->SetPriority(
-      spdy::SpdyStreamPrecedence(QuicSpdyStream::kDefaultUrgency));
-
-  // No PRIORITY_UPDATE frames on the control stream.
+  // No PRIORITY_UPDATE frames on the control stream,
+  // because the stream has default priority.
   auto send_control_stream =
       QuicSpdySessionPeer::GetSendControlStream(session_.get());
   EXPECT_CALL(*session_, WritevData(send_control_stream,
@@ -1382,17 +1352,13 @@
   // Two writes on the request stream: HEADERS frame header and payload.
   EXPECT_CALL(*session_, WritevData(stream_, stream_->id(), _, _, _)).Times(2);
   EXPECT_CALL(*stream_, WriteHeadersMock(false));
+  stream_->WriteHeaders(SpdyHeaderBlock(), /*fin=*/false, nullptr);
+
   // PRIORITY_UPDATE frame on the control stream.
   auto send_control_stream =
       QuicSpdySessionPeer::GetSendControlStream(session_.get());
   EXPECT_CALL(*session_, WritevData(send_control_stream,
                                     send_control_stream->id(), _, _, _));
-  stream_->WriteHeaders(SpdyHeaderBlock(), /*fin=*/false, nullptr);
-  testing::Mock::VerifyAndClearExpectations(session_.get());
-
-  // Another PRIORITY_UPDATE frame.
-  EXPECT_CALL(*session_, WritevData(send_control_stream,
-                                    send_control_stream->id(), _, _, _));
   stream_->SetPriority(spdy::SpdyStreamPrecedence(kV3HighestPriority));
 }