Add operator!= to QUIC TransportParameters

I forgot to ask about this when reviewing cl/305724142, so I figured I'd add it instead.

gfe-relnote: n/a, new unused functionality
PiperOrigin-RevId: 305732997
Change-Id: I367e5bfb3aceaa898dff0582d8c1b75ae530be01
diff --git a/quic/core/crypto/crypto_handshake_message.cc b/quic/core/crypto/crypto_handshake_message.cc
index d0e66d8..e0c2528 100644
--- a/quic/core/crypto/crypto_handshake_message.cc
+++ b/quic/core/crypto/crypto_handshake_message.cc
@@ -56,6 +56,11 @@
          minimum_size_ == rhs.minimum_size_;
 }
 
+bool CryptoHandshakeMessage::operator!=(
+    const CryptoHandshakeMessage& rhs) const {
+  return !(*this == rhs);
+}
+
 void CryptoHandshakeMessage::Clear() {
   tag_ = 0;
   tag_value_map_.clear();
diff --git a/quic/core/crypto/crypto_handshake_message.h b/quic/core/crypto/crypto_handshake_message.h
index b5996de..9539050 100644
--- a/quic/core/crypto/crypto_handshake_message.h
+++ b/quic/core/crypto/crypto_handshake_message.h
@@ -31,6 +31,7 @@
   CryptoHandshakeMessage& operator=(CryptoHandshakeMessage&& other);
 
   bool operator==(const CryptoHandshakeMessage& rhs) const;
+  bool operator!=(const CryptoHandshakeMessage& rhs) const;
 
   // Clears state.
   void Clear();
diff --git a/quic/core/crypto/transport_parameters.cc b/quic/core/crypto/transport_parameters.cc
index 422be3d..62f3c9c 100644
--- a/quic/core/crypto/transport_parameters.cc
+++ b/quic/core/crypto/transport_parameters.cc
@@ -320,6 +320,11 @@
          stateless_reset_token == rhs.stateless_reset_token;
 }
 
+bool TransportParameters::PreferredAddress::operator!=(
+    const PreferredAddress& rhs) const {
+  return !(*this == rhs);
+}
+
 std::ostream& operator<<(
     std::ostream& os,
     const TransportParameters::PreferredAddress& preferred_address) {
@@ -507,6 +512,10 @@
   return address && google_quic;
 }
 
+bool TransportParameters::operator!=(const TransportParameters& rhs) const {
+  return !(*this == rhs);
+}
+
 bool TransportParameters::AreValid(std::string* error_details) const {
   DCHECK(perspective == Perspective::IS_CLIENT ||
          perspective == Perspective::IS_SERVER);
diff --git a/quic/core/crypto/transport_parameters.h b/quic/core/crypto/transport_parameters.h
index e3d6782..a06f74c 100644
--- a/quic/core/crypto/transport_parameters.h
+++ b/quic/core/crypto/transport_parameters.h
@@ -93,6 +93,7 @@
     PreferredAddress(PreferredAddress&& other) = default;
     ~PreferredAddress();
     bool operator==(const PreferredAddress& rhs) const;
+    bool operator!=(const PreferredAddress& rhs) const;
 
     QuicSocketAddress ipv4_socket_address;
     QuicSocketAddress ipv6_socket_address;
@@ -110,6 +111,7 @@
   TransportParameters(const TransportParameters& other);
   ~TransportParameters();
   bool operator==(const TransportParameters& rhs) const;
+  bool operator!=(const TransportParameters& rhs) const;
 
   // Represents the sender of the transport parameters. When |perspective| is
   // Perspective::IS_CLIENT, this struct is being used in the client_hello
diff --git a/quic/core/crypto/transport_parameters_test.cc b/quic/core/crypto/transport_parameters_test.cc
index 2ed7d63..4c66546 100644
--- a/quic/core/crypto/transport_parameters_test.cc
+++ b/quic/core/crypto/transport_parameters_test.cc
@@ -20,9 +20,6 @@
 namespace test {
 namespace {
 
-using testing::Pair;
-using testing::UnorderedElementsAre;
-
 const QuicVersionLabel kFakeVersionLabel = 0x01234567;
 const QuicVersionLabel kFakeVersionLabel2 = 0x89ABCDEF;
 const uint64_t kFakeIdleTimeoutMilliseconds = 12012;
@@ -132,36 +129,52 @@
   // Test comparison on primitive members.
   orig_params.perspective = Perspective::IS_CLIENT;
   new_params.perspective = Perspective::IS_SERVER;
+  EXPECT_NE(orig_params, new_params);
   EXPECT_FALSE(orig_params == new_params);
+  EXPECT_TRUE(orig_params != new_params);
   new_params.perspective = Perspective::IS_CLIENT;
   orig_params.version = kFakeVersionLabel;
   new_params.version = kFakeVersionLabel;
   orig_params.disable_migration = true;
   new_params.disable_migration = true;
   EXPECT_EQ(orig_params, new_params);
+  EXPECT_TRUE(orig_params == new_params);
+  EXPECT_FALSE(orig_params != new_params);
 
   // Test comparison on vectors.
   orig_params.supported_versions.push_back(kFakeVersionLabel);
   new_params.supported_versions.push_back(kFakeVersionLabel2);
+  EXPECT_NE(orig_params, new_params);
   EXPECT_FALSE(orig_params == new_params);
+  EXPECT_TRUE(orig_params != new_params);
   new_params.supported_versions.pop_back();
   new_params.supported_versions.push_back(kFakeVersionLabel);
   orig_params.stateless_reset_token = CreateFakeStatelessResetToken();
   new_params.stateless_reset_token = CreateFakeStatelessResetToken();
   EXPECT_EQ(orig_params, new_params);
+  EXPECT_TRUE(orig_params == new_params);
+  EXPECT_FALSE(orig_params != new_params);
 
   // Test comparison on IntegerParameters.
   orig_params.max_packet_size.set_value(kFakeMaxPacketSize);
   new_params.max_packet_size.set_value(kFakeMaxPacketSize + 1);
+  EXPECT_NE(orig_params, new_params);
   EXPECT_FALSE(orig_params == new_params);
+  EXPECT_TRUE(orig_params != new_params);
   new_params.max_packet_size.set_value(kFakeMaxPacketSize);
   EXPECT_EQ(orig_params, new_params);
+  EXPECT_TRUE(orig_params == new_params);
+  EXPECT_FALSE(orig_params != new_params);
 
   // Test comparison on PreferredAddress
   orig_params.preferred_address = CreateFakePreferredAddress();
+  EXPECT_NE(orig_params, new_params);
   EXPECT_FALSE(orig_params == new_params);
+  EXPECT_TRUE(orig_params != new_params);
   new_params.preferred_address = CreateFakePreferredAddress();
   EXPECT_EQ(orig_params, new_params);
+  EXPECT_TRUE(orig_params == new_params);
+  EXPECT_FALSE(orig_params != new_params);
 
   // Test comparison on CryptoHandshakeMessage.
   orig_params.google_quic_params = std::make_unique<CryptoHandshakeMessage>();
@@ -169,14 +182,20 @@
   orig_params.google_quic_params->SetStringPiece(42, kTestString);
   const uint32_t kTestValue = 12;
   orig_params.google_quic_params->SetValue(1337, kTestValue);
+  EXPECT_NE(orig_params, new_params);
   EXPECT_FALSE(orig_params == new_params);
+  EXPECT_TRUE(orig_params != new_params);
 
   new_params.google_quic_params = std::make_unique<CryptoHandshakeMessage>();
   new_params.google_quic_params->SetStringPiece(42, kTestString);
   new_params.google_quic_params->SetValue(1337, kTestValue + 1);
+  EXPECT_NE(orig_params, new_params);
   EXPECT_FALSE(orig_params == new_params);
+  EXPECT_TRUE(orig_params != new_params);
   new_params.google_quic_params->SetValue(1337, kTestValue);
   EXPECT_EQ(orig_params, new_params);
+  EXPECT_TRUE(orig_params == new_params);
+  EXPECT_FALSE(orig_params != new_params);
 
   // Test comparison on CustomMap
   orig_params.custom_parameters[kCustomParameter1] = kCustomParameter1Value;
@@ -185,6 +204,8 @@
   new_params.custom_parameters[kCustomParameter2] = kCustomParameter2Value;
   new_params.custom_parameters[kCustomParameter1] = kCustomParameter1Value;
   EXPECT_EQ(orig_params, new_params);
+  EXPECT_TRUE(orig_params == new_params);
+  EXPECT_FALSE(orig_params != new_params);
 }
 
 TEST_P(TransportParametersTest, CopyConstructor) {