Bug 1251822 - Disable ChaCha20Poly1305 for unit tests that check cipher suite, r?ekr draft
authorMartin Thomson <martin.thomson@gmail.com>
Mon, 29 Feb 2016 12:18:27 +1100
changeset 335291 c9abb70d42176343480a3ceb72e5332c16b7a645
parent 332836 32dc11f5f92e014d30c18d3a4045d5f8363694c2
child 515109 27afd671b3f6f011f2ba381ca8e4057b4cfd342a
push id11762
push usermartin.thomson@gmail.com
push dateMon, 29 Feb 2016 01:23:08 +0000
reviewersekr
bugs1251822
milestone47.0a1
Bug 1251822 - Disable ChaCha20Poly1305 for unit tests that check cipher suite, r?ekr MozReview-Commit-ID: J0i73XnMVOM
media/mtransport/test/transport_unittests.cpp
--- a/media/mtransport/test/transport_unittests.cpp
+++ b/media/mtransport/test/transport_unittests.cpp
@@ -955,30 +955,42 @@ class TransportTest : public ::testing::
   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());
 }