Use IsStreamError() and friends gMock matchers in quic/quartc.

gfe-relnote: n/a, test-only change.
PiperOrigin-RevId: 282776007
Change-Id: Ic2270f5487ed7ece336f32afb8d2520334799630
diff --git a/quic/quartc/quartc_endpoint_test.cc b/quic/quartc/quartc_endpoint_test.cc
index 165139c..8506067 100644
--- a/quic/quartc/quartc_endpoint_test.cc
+++ b/quic/quartc/quartc_endpoint_test.cc
@@ -11,6 +11,7 @@
 #include "net/third_party/quiche/src/quic/quartc/quartc_crypto_helpers.h"
 #include "net/third_party/quiche/src/quic/quartc/quartc_fakes.h"
 #include "net/third_party/quiche/src/quic/quartc/simulated_packet_transport.h"
+#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/link.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h"
 
@@ -195,7 +196,8 @@
     return client_endpoint_delegate_.session() != nullptr &&
            client_endpoint_delegate_.session()->error() != QUIC_NO_ERROR;
   }));
-  EXPECT_EQ(client_endpoint_delegate_.session()->error(), QUIC_INVALID_VERSION);
+  EXPECT_THAT(client_endpoint_delegate_.session()->error(),
+              test::IsError(QUIC_INVALID_VERSION));
 }
 
 // Tests that the client endpoint can create a new session in order to continue
diff --git a/quic/quartc/quartc_multiplexer_test.cc b/quic/quartc/quartc_multiplexer_test.cc
index a8f5352..3cc088b 100644
--- a/quic/quartc/quartc_multiplexer_test.cc
+++ b/quic/quartc/quartc_multiplexer_test.cc
@@ -23,6 +23,7 @@
 #include "net/third_party/quiche/src/quic/quartc/quartc_session.h"
 #include "net/third_party/quiche/src/quic/quartc/quartc_stream.h"
 #include "net/third_party/quiche/src/quic/quartc/simulated_packet_transport.h"
+#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/link.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h"
 
@@ -468,8 +469,10 @@
   Connect();
   Disconnect();
 
-  EXPECT_EQ(client_session_delegate_.error(), QUIC_CONNECTION_CANCELLED);
-  EXPECT_EQ(server_session_delegate_.error(), QUIC_CONNECTION_CANCELLED);
+  EXPECT_THAT(client_session_delegate_.error(),
+              test::IsError(QUIC_CONNECTION_CANCELLED));
+  EXPECT_THAT(server_session_delegate_.error(),
+              test::IsError(QUIC_CONNECTION_CANCELLED));
 }
 
 TEST_F(QuartcMultiplexerTest, CongestionEvent) {
diff --git a/quic/quartc/quartc_session_test.cc b/quic/quartc/quartc_session_test.cc
index 6ed8ec5..956073b 100644
--- a/quic/quartc/quartc_session_test.cc
+++ b/quic/quartc/quartc_session_test.cc
@@ -20,6 +20,7 @@
 #include "net/third_party/quiche/src/quic/quartc/quartc_packet_writer.h"
 #include "net/third_party/quiche/src/quic/quartc/simulated_packet_transport.h"
 #include "net/third_party/quiche/src/quic/test_tools/mock_clock.h"
+#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/packet_filter.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h"
 
@@ -543,10 +544,10 @@
 
   EXPECT_TRUE(client_peer_->IsClosedStream(stream_id));
   EXPECT_TRUE(server_peer_->IsClosedStream(stream_id));
-  EXPECT_EQ(client_stream_delegate_->stream_error(stream_id),
-            QUIC_STREAM_CANCELLED);
-  EXPECT_EQ(server_stream_delegate_->stream_error(stream_id),
-            QUIC_STREAM_CANCELLED);
+  EXPECT_THAT(client_stream_delegate_->stream_error(stream_id),
+              test::IsStreamError(QUIC_STREAM_CANCELLED));
+  EXPECT_THAT(server_stream_delegate_->stream_error(stream_id),
+              test::IsStreamError(QUIC_STREAM_CANCELLED));
 }
 
 TEST_F(QuartcSessionTest, LostDatagramNotifications) {
diff --git a/quic/quartc/quartc_stream_test.cc b/quic/quartc/quartc_stream_test.cc
index 0acaded..0e972e5 100644
--- a/quic/quartc/quartc_stream_test.cc
+++ b/quic/quartc/quartc_stream_test.cc
@@ -38,6 +38,9 @@
 #include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
 #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
 
+using ::quic::test::IsQuicStreamNoError;
+using ::quic::test::IsStreamError;
+
 namespace quic {
 
 namespace {
@@ -419,7 +422,7 @@
   stream_->OnCanWrite();
 
   EXPECT_EQ("Foo barFoo bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_NO_ERROR);
+  EXPECT_THAT(stream_->stream_error(), IsQuicStreamNoError());
 }
 
 TEST_F(QuartcStreamTest, TestCancelOnLossEnabled) {
@@ -436,7 +439,7 @@
   stream_->OnCanWrite();
 
   EXPECT_EQ("Foo bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_CANCELLED);
+  EXPECT_THAT(stream_->stream_error(), IsStreamError(QUIC_STREAM_CANCELLED));
 }
 
 TEST_F(QuartcStreamTest, MaxRetransmissionsAbsent) {
@@ -456,7 +459,7 @@
   stream_->OnCanWrite();
 
   EXPECT_EQ("Foo barFoo bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_NO_ERROR);
+  EXPECT_THAT(stream_->stream_error(), IsQuicStreamNoError());
 }
 
 TEST_F(QuartcStreamTest, MaxRetransmissionsSet) {
@@ -483,7 +486,7 @@
   stream_->OnCanWrite();
 
   EXPECT_EQ("Foo barFoo barFoo bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_CANCELLED);
+  EXPECT_THAT(stream_->stream_error(), IsStreamError(QUIC_STREAM_CANCELLED));
 }
 
 TEST_F(QuartcStreamTest, MaxRetransmissionsDisjointFrames) {
@@ -542,7 +545,7 @@
   stream_->OnCanWrite();
 
   EXPECT_EQ("Foo barFoo  bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_CANCELLED);
+  EXPECT_THAT(stream_->stream_error(), IsStreamError(QUIC_STREAM_CANCELLED));
 }
 
 TEST_F(QuartcStreamTest, MaxRetransmissionsWithAckedFrame) {
@@ -579,7 +582,7 @@
 
   // QuartcStream should be cancelled, but it stopped tracking the lost bytes
   // after they were acked, so it's not.
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_NO_ERROR);
+  EXPECT_THAT(stream_->stream_error(), IsQuicStreamNoError());
 }
 
 TEST_F(QuartcStreamTest, TestBytesPendingRetransmission) {
@@ -605,7 +608,7 @@
   EXPECT_EQ(mock_stream_delegate_->last_bytes_pending_retransmission(), 0u);
 
   EXPECT_EQ("Foo barFoo bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_NO_ERROR);
+  EXPECT_THAT(stream_->stream_error(), IsQuicStreamNoError());
 }
 
 TEST_F(QuartcStreamTest, TestBytesPendingRetransmissionWithCancelOnLoss) {
@@ -631,7 +634,7 @@
   EXPECT_EQ(mock_stream_delegate_->last_bytes_pending_retransmission(), 0u);
 
   EXPECT_EQ("Foo bar", write_buffer_);
-  EXPECT_EQ(stream_->stream_error(), QUIC_STREAM_CANCELLED);
+  EXPECT_THAT(stream_->stream_error(), IsStreamError(QUIC_STREAM_CANCELLED));
 }
 
 }  // namespace