Bug 1251822 - Disable ChaCha20Poly1305 for unit tests that check cipher suite, r=ekr draft
authorMartin Thomson <martin.thomson@gmail.com>
Wed, 16 Mar 2016 17:52:49 +1100
changeset 340949 7d637e24ea89c0d070fbe0511dd445f8d11e51f6
parent 340948 a901636216df5968b064405f6b9b11f15da475c6
child 516299 7bba430290f823348a955249be2f095d41beef7d
push id13099
push usermartin.thomson@gmail.com
push dateWed, 16 Mar 2016 06:57:12 +0000
reviewersekr
bugs1251822
milestone48.0a1
Bug 1251822 - Disable ChaCha20Poly1305 for unit tests that check cipher suite, r=ekr MozReview-Commit-ID: H7IW0iOTAzx
media/mtransport/test/transport_unittests.cpp
--- a/media/mtransport/test/transport_unittests.cpp
+++ b/media/mtransport/test/transport_unittests.cpp
@@ -957,30 +957,42 @@ class TransportTest : public MtransportT
   nsCOMPtr<nsIEventTarget> target_;
 };
 
 
 TEST_F(TransportTest, TestNoDtlsVerificationSettings) {
   ConnectSocketExpectFail();
 }
 
+static void DisableChaCha(TransportTestPeer* peer) {
+  // On ARM, ChaCha20Poly1305 might be preferred; disable it for the tests that
+  // want to check the cipher suite.  It doesn't matter which peer disables the
+  // suite, disabling on either side has the same effect.
+  std::vector<uint16_t> chachaSuites;
+  chachaSuites.push_back(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256);
+  chachaSuites.push_back(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256);
+  peer->SetCipherSuiteChanges(std::vector<uint16_t>(), chachaSuites);
+}
+
 TEST_F(TransportTest, TestConnect) {
   SetDtlsPeer();
+  DisableChaCha(p1_);
   ConnectSocket();
 
   // check that we got the right suite
   ASSERT_EQ(TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, p1_->cipherSuite());
 
   // no SRTP on this one
   ASSERT_EQ(0, p1_->srtpCipher());
 }
 
 TEST_F(TransportTest, TestConnectSrtp) {
   SetupSrtp();
   SetDtlsPeer();
+  DisableChaCha(p2_);
   ConnectSocket();
 
   ASSERT_EQ(TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, p1_->cipherSuite());
 
   // SRTP is on
   ASSERT_EQ(SRTP_AES128_CM_HMAC_SHA1_80, p1_->srtpCipher());
 }