Update PreSharedKey tests to pass without non-fatal QUIC_BUG The PreSharedKey tests were relying on a QUIC_BUG call to not terminate program execution, but this seems like an implementation detail (one that might be worth changing in the Chromium implementation). It seems that there was some related work on this in https://github.com/google/quiche/commit/b45e7741802e3b1fbe5635ea6798df0ce0991a16, but the change there isn't enough to get the test passing locally for me for some reason. 🤔 PiperOrigin-RevId: 650760186
diff --git a/quiche/quic/core/http/end_to_end_test.cc b/quiche/quic/core/http/end_to_end_test.cc index ed788bb..4e46693 100644 --- a/quiche/quic/core/http/end_to_end_test.cc +++ b/quiche/quic/core/http/end_to_end_test.cc
@@ -919,6 +919,29 @@ } } + // TODO(b/154162689) Remove this method once PSK support is added for + // QUIC+TLS. + void InitializeAndCheckForTlsPskFailure(bool expect_client_failure = true) { + connect_to_server_on_initialize_ = false; + EXPECT_TRUE(Initialize()); + + EXPECT_QUIC_BUG( + CreateClientWithWriter(), + expect_client_failure + ? "QUIC client pre-shared keys not yet supported with TLS" + : "QUIC server pre-shared keys not yet supported with TLS"); + + // Reset the client and server state so that `TearDown()` can complete + // successfully. + pre_shared_key_client_ = ""; + pre_shared_key_server_ = ""; + StopServer(); + server_writer_ = new PacketDroppingTestWriter(); + StartServer(); + client_writer_ = new PacketDroppingTestWriter(); + CreateClientWithWriter(); + } + quiche::test::ScopedEnvironmentForThreads environment_; bool initialized_; // If true, the Initialize() function will create |client_| and starts to @@ -5010,8 +5033,7 @@ if (version_.UsesTls()) { // TODO(b/154162689) add PSK support to QUIC+TLS. - EXPECT_QUIC_BUG(EXPECT_FALSE(Initialize()), - "QUIC client pre-shared keys not yet supported with TLS"); + InitializeAndCheckForTlsPskFailure(); return; } @@ -5031,8 +5053,7 @@ if (version_.UsesTls()) { // TODO(b/154162689) add PSK support to QUIC+TLS. - EXPECT_QUIC_BUG(EXPECT_FALSE(Initialize()), - "QUIC client pre-shared keys not yet supported with TLS"); + InitializeAndCheckForTlsPskFailure(); return; } @@ -5056,8 +5077,7 @@ if (version_.UsesTls()) { // TODO(b/154162689) add PSK support to QUIC+TLS. - EXPECT_QUIC_BUG(EXPECT_FALSE(Initialize()), - "QUIC server pre-shared keys not yet supported with TLS"); + InitializeAndCheckForTlsPskFailure(/*expect_client_failure=*/false); return; } @@ -5075,8 +5095,7 @@ if (version_.UsesTls()) { // TODO(b/154162689) add PSK support to QUIC+TLS. - EXPECT_QUIC_BUG(EXPECT_FALSE(Initialize()), - "QUIC client pre-shared keys not yet supported with TLS"); + InitializeAndCheckForTlsPskFailure(); return; }