Bug 1271682 - Move JSEP-related tests from signaling_unittests to jsep_session_unittest; r=bwc draft
authorDan Minor <dminor@mozilla.com>
Wed, 30 Nov 2016 15:23:19 -0500
changeset 455441 568bfa9bdee405f2b6504bea5c58e9408ee26b3c
parent 455138 31ffcb82ced81bb75faa800d2b7e883a3761a03b
child 540993 772c0a8d7b4217c684e300a7801a61167ce9f4ac
push id40242
push userdminor@mozilla.com
push dateTue, 03 Jan 2017 20:06:07 +0000
reviewersbwc
bugs1271682
milestone53.0a1
Bug 1271682 - Move JSEP-related tests from signaling_unittests to jsep_session_unittest; r=bwc MozReview-Commit-ID: 2lpqamozFXP
media/webrtc/signaling/gtest/jsep_session_unittest.cpp
media/webrtc/signaling/test/signaling_unittests.cpp
--- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -4218,9 +4218,884 @@ TEST_F(JsepSessionTest, TestNonDefaultPr
   parsedOffer = Parse(offer);
   ASSERT_EQ(3U, parsedOffer->GetMediaSectionCount());
   ASSERT_EQ(SdpMediaSection::kRtpSavpf,
             parsedOffer->GetMediaSection(0).GetProtocol());
   ASSERT_EQ(SdpMediaSection::kRtpSavpf,
             parsedOffer->GetMediaSection(1).GetProtocol());
 }
 
+TEST_F(JsepSessionTest, CreateOfferNoVideoStreamRecvVideo)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferNoAudioStreamRecvAudio)
+{
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferNoVideoStream)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferNoAudioStream)
+{
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(0U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferDontReceiveAudio)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(0U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferDontReceiveVideo)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferRemoveAudioTrack)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
+
+  RefPtr<JsepTrack> removedTrack = GetTrackOff(0, types.front());
+  ASSERT_TRUE(removedTrack);
+  ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(),
+                                           removedTrack->GetTrackId()));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferDontReceiveAudioRemoveAudioTrack)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(0U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  RefPtr<JsepTrack> removedTrack = GetTrackOff(0, types.front());
+  ASSERT_TRUE(removedTrack);
+  ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(),
+                                           removedTrack->GetTrackId()));
+
+  CreateOffer(Some(options));
+}
+
+TEST_F(JsepSessionTest, CreateOfferDontReceiveVideoRemoveVideoTrack)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(0U));
+
+  RefPtr<JsepTrack> removedTrack = GetTrackOff(0, types.back());
+  ASSERT_TRUE(removedTrack);
+  ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(),
+                                           removedTrack->GetTrackId()));
+
+  CreateOffer(Some(options));
+}
+
+static const std::string strSampleCandidate =
+  "a=candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host\r\n";
+
+static const unsigned short nSamplelevel = 2;
+
+TEST_F(JsepSessionTest, CreateOfferAddCandidate)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+
+  std::string mid;
+  bool skipped;
+  nsresult rv;
+  rv = mSessionOff.AddLocalIceCandidate(strSampleCandidate,
+                                        nSamplelevel, &mid, &skipped);
+  ASSERT_EQ(NS_OK, rv);
+}
+
+TEST_F(JsepSessionTest, AddIceCandidateEarly)
+{
+  std::string mid;
+  bool skipped;
+  nsresult rv;
+  rv = mSessionOff.AddLocalIceCandidate(strSampleCandidate,
+                                        nSamplelevel, &mid, &skipped);
+
+  // This can't succeed without a local description
+  ASSERT_NE(NS_OK, rv);
+}
+
+TEST_F(JsepSessionTest, OfferAnswerDontAddAudioStreamOnAnswerNoOptions)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+  AddTracks(mSessionAns, "video");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  CreateOffer(Some(options));
+  std::string offer = CreateOffer(Some(options));
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  SetLocalAnswer(answer, CHECK_SUCCESS);
+  SetRemoteAnswer(answer, CHECK_SUCCESS);
+}
+
+TEST_F(JsepSessionTest, OfferAnswerDontAddVideoStreamOnAnswerNoOptions)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+  AddTracks(mSessionAns, "audio");
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  CreateOffer(Some(options));
+  std::string offer = CreateOffer(Some(options));
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  SetLocalAnswer(answer, CHECK_SUCCESS);
+  SetRemoteAnswer(answer, CHECK_SUCCESS);
+}
+
+TEST_F(JsepSessionTest, OfferAnswerDontAddAudioVideoStreamsOnAnswerNoOptions)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+  AddTracks(mSessionAns);
+
+  JsepOfferOptions options;
+  options.mOfferToReceiveAudio = Some(static_cast<size_t>(1U));
+  options.mOfferToReceiveVideo = Some(static_cast<size_t>(1U));
+
+  OfferAnswer();
+}
+
+TEST_F(JsepSessionTest, OfferAndAnswerWithExtraCodec)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+
+  UniquePtr<Sdp> munge = Parse(answer);
+  SdpMediaSection& mediaSection = munge->GetMediaSection(0);
+  mediaSection.AddCodec("8", "PCMA", 8000, 1);
+  std::string sdpString = munge->ToString();
+
+  SetLocalAnswer(sdpString);
+  SetRemoteAnswer(answer);
+}
+
+TEST_F(JsepSessionTest, AddCandidateInHaveLocalOffer) {
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+
+  nsresult rv;
+  std::string mid;
+  rv = mSessionOff.AddRemoteIceCandidate(strSampleCandidate,
+                                         mid, nSamplelevel);
+  ASSERT_EQ(NS_ERROR_UNEXPECTED, rv);
+}
+
+TEST_F(JsepSessionTest, SetLocalWithoutCreateOffer) {
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+
+  std::string offer = CreateOffer();
+  nsresult rv = mSessionAns.SetLocalDescription(kJsepSdpOffer, offer);
+  ASSERT_EQ(NS_ERROR_UNEXPECTED, rv);
+}
+
+TEST_F(JsepSessionTest, SetLocalWithoutCreateAnswer) {
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+
+  std::string offer = CreateOffer();
+  SetRemoteOffer(offer);
+  nsresult rv = mSessionAns.SetLocalDescription(kJsepSdpAnswer, offer);
+  ASSERT_EQ(NS_ERROR_UNEXPECTED, rv);
+}
+
+// Test for Bug 843595
+TEST_F(JsepSessionTest, missingUfrag)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string ufrag = "ice-ufrag";
+  std::size_t pos = offer.find(ufrag);
+  ASSERT_NE(pos, std::string::npos);
+  offer.replace(pos, ufrag.length(), "ice-ufrog");
+  nsresult rv = mSessionAns.SetRemoteDescription(kJsepSdpOffer, offer);
+  ASSERT_EQ(NS_ERROR_INVALID_ARG, rv);
+}
+
+TEST_F(JsepSessionTest, AudioOnlyCalleeNoRtcpMux)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string rtcp_mux = "a=rtcp-mux\r\n";
+  std::size_t pos = offer.find(rtcp_mux);
+  ASSERT_NE(pos, std::string::npos);
+  offer.replace(pos, rtcp_mux.length(), "");
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  pos = answer.find(rtcp_mux);
+  ASSERT_EQ(pos, std::string::npos);
+}
+
+// This test comes from Bug 810220
+TEST_F(JsepSessionTest, AudioOnlyG711Call)
+{
+  std::string offer =
+    "v=0\r\n"
+    "o=- 1 1 IN IP4 148.147.200.251\r\n"
+    "s=-\r\n"
+    "b=AS:64\r\n"
+    "t=0 0\r\n"
+    "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
+      "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
+    "m=audio 9000 UDP/TLS/RTP/SAVPF 0 8 126\r\n"
+    "c=IN IP4 148.147.200.251\r\n"
+    "b=TIAS:64000\r\n"
+    "a=rtpmap:0 PCMU/8000\r\n"
+    "a=rtpmap:8 PCMA/8000\r\n"
+    "a=rtpmap:126 telephone-event/8000\r\n"
+    "a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
+    "a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
+    "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
+    "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
+    "a=setup:active\r\n"
+    "a=sendrecv\r\n";
+
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionAns, "audio");
+  SetRemoteOffer(offer, CHECK_SUCCESS);
+  std::string answer = CreateAnswer();
+
+  // They didn't offer opus, so our answer shouldn't include it.
+  ASSERT_EQ(answer.find(" opus/"), std::string::npos);
+
+  // They also didn't offer video or application
+  ASSERT_EQ(answer.find("video"), std::string::npos);
+  ASSERT_EQ(answer.find("application"), std::string::npos);
+
+  // We should answer with PCMU and telephone-event
+  ASSERT_NE(answer.find(" PCMU/8000"), std::string::npos);
+
+  // Double-check the directionality
+  ASSERT_NE(answer.find("\r\na=sendrecv"), std::string::npos);
+
+}
+
+TEST_F(JsepSessionTest, AudioOnlyG722Only)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+
+  std::string audio = "m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101\r\n";
+  std::size_t pos = offer.find(audio);
+  ASSERT_NE(pos, std::string::npos);
+  offer.replace(pos, audio.length(),
+                "m=audio 65375 UDP/TLS/RTP/SAVPF 9\r\n");
+  SetRemoteOffer(offer);
+
+  std::string answer = CreateAnswer();
+  SetLocalAnswer(answer);
+  ASSERT_NE(mSessionAns.GetLocalDescription().find("UDP/TLS/RTP/SAVPF 9\r"),
+            std::string::npos);
+  ASSERT_NE(mSessionAns.GetLocalDescription().find("a=rtpmap:9 G722/8000"),
+            std::string::npos);
+}
+
+TEST_F(JsepSessionTest, AudioOnlyG722Rejected)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+
+  std::string audio = "m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101\r\n";
+  std::size_t pos = offer.find(audio);
+  ASSERT_NE(pos, std::string::npos);
+  offer.replace(pos, audio.length(),
+                "m=audio 65375 UDP/TLS/RTP/SAVPF 0 8\r\n");
+  SetRemoteOffer(offer);
+
+  std::string answer = CreateAnswer();
+  SetLocalAnswer(answer);
+  SetRemoteAnswer(answer);
+
+  // TODO(bug 814227): Use commented out code instead.
+  ASSERT_NE(mSessionAns.GetLocalDescription().find("UDP/TLS/RTP/SAVPF 0\r"),
+            std::string::npos);
+  // ASSERT_NE(mSessionAns.GetLocalDescription().find("UDP/TLS/RTP/SAVPF 0 8\r"), std::string::npos);
+  ASSERT_NE(mSessionAns.GetLocalDescription().find("a=rtpmap:0 PCMU/8000"), std::string::npos);
+  ASSERT_EQ(mSessionAns.GetLocalDescription().find("a=rtpmap:109 opus/48000/2"), std::string::npos);
+  ASSERT_EQ(mSessionAns.GetLocalDescription().find("a=rtpmap:9 G722/8000"), std::string::npos);
+}
+
+// This test doesn't make sense for bundle
+TEST_F(JsepSessionTest, DISABLED_FullCallAudioNoMuxVideoMux)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio,video");
+  AddTracks(mSessionAns, "audio,video");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+  std::string rtcp_mux = "a=rtcp-mux\r\n";
+  std::size_t pos = offer.find(rtcp_mux);
+  ASSERT_NE(pos, std::string::npos);
+  offer.replace(pos, rtcp_mux.length(), "");
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+
+  size_t match = mSessionAns.GetLocalDescription().find("\r\na=rtcp-mux");
+  ASSERT_NE(match, std::string::npos);
+  match = mSessionAns.GetLocalDescription().find("\r\na=rtcp-mux", match + 1);
+  ASSERT_EQ(match, std::string::npos);
+}
+
+// Disabled pending resolution of bug 818640.
+// Actually, this test is completely broken; you can't just call
+// SetRemote/CreateAnswer over and over again.
+TEST_F(JsepSessionTest, DISABLED_OfferAllDynamicTypes)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionAns, "audio");
+
+  std::string offer;
+  for (int i = 96; i < 128; i++)
+  {
+    std::stringstream ss;
+    ss << i;
+    std::cout << "Trying dynamic pt = " << i << std::endl;
+    offer =
+      "v=0\r\n"
+      "o=- 1 1 IN IP4 148.147.200.251\r\n"
+      "s=-\r\n"
+      "b=AS:64\r\n"
+      "t=0 0\r\n"
+      "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
+        "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
+      "m=audio 9000 RTP/AVP " + ss.str() + "\r\n"
+      "c=IN IP4 148.147.200.251\r\n"
+      "b=TIAS:64000\r\n"
+      "a=rtpmap:" + ss.str() +" opus/48000/2\r\n"
+      "a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
+      "a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
+      "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
+      "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
+      "a=sendrecv\r\n";
+
+      SetRemoteOffer(offer, CHECK_SUCCESS);
+      std::string answer = CreateAnswer();
+      ASSERT_NE(answer.find(ss.str() + " opus/"), std::string::npos);
+  }
+}
+
+TEST_F(JsepSessionTest, ipAddrAnyOffer)
+{
+  std::string offer =
+    "v=0\r\n"
+    "o=- 1 1 IN IP4 127.0.0.1\r\n"
+    "s=-\r\n"
+    "b=AS:64\r\n"
+    "t=0 0\r\n"
+    "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
+      "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
+    "m=audio 9000 UDP/TLS/RTP/SAVPF 99\r\n"
+    "c=IN IP4 0.0.0.0\r\n"
+    "a=rtpmap:99 opus/48000/2\r\n"
+    "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
+    "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
+    "a=setup:active\r\n"
+    "a=sendrecv\r\n";
+
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionAns, "audio");
+  SetRemoteOffer(offer, CHECK_SUCCESS);
+  std::string answer = CreateAnswer();
+
+  ASSERT_NE(answer.find("a=sendrecv"), std::string::npos);
+}
+
+static void CreateSDPForBigOTests(std::string& offer, const std::string& number) {
+  offer =
+    "v=0\r\n"
+    "o=- ";
+  offer += number;
+  offer += " ";
+  offer += number;
+  offer += " IN IP4 127.0.0.1\r\n"
+    "s=-\r\n"
+    "b=AS:64\r\n"
+    "t=0 0\r\n"
+    "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
+      "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
+    "m=audio 9000 RTP/AVP 99\r\n"
+    "c=IN IP4 0.0.0.0\r\n"
+    "a=rtpmap:99 opus/48000/2\r\n"
+    "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
+    "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
+    "a=setup:active\r\n"
+    "a=sendrecv\r\n";
+}
+
+TEST_F(JsepSessionTest, BigOValues)
+{
+  std::string offer;
+
+  CreateSDPForBigOTests(offer, "12345678901234567");
+
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionAns, "audio");
+  SetRemoteOffer(offer, CHECK_SUCCESS);
+}
+
+TEST_F(JsepSessionTest, BigOValuesExtraChars)
+{
+  std::string offer;
+
+  CreateSDPForBigOTests(offer, "12345678901234567FOOBAR");
+
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionAns, "audio");
+  // The signaling state will remain "stable" because the unparsable
+  // SDP leads to a failure in SetRemoteDescription.
+  SetRemoteOffer(offer, NO_CHECKS);
+  ASSERT_EQ(kJsepStateStable, mSessionAns.GetState());
+}
+
+TEST_F(JsepSessionTest, BigOValuesTooBig)
+{
+  std::string offer;
+
+  CreateSDPForBigOTests(offer, "18446744073709551615");
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionAns, "audio");
+
+  // The signaling state will remain "stable" because the unparsable
+  // SDP leads to a failure in SetRemoteDescription.
+  SetRemoteOffer(offer, NO_CHECKS);
+  ASSERT_EQ(kJsepStateStable, mSessionAns.GetState());
+}
+
+
+TEST_F(JsepSessionTest, SetLocalAnswerInStable)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+
+  // The signaling state will remain "stable" because the
+  // SetLocalDescription call fails.
+  SetLocalAnswer(offer, NO_CHECKS);
+  ASSERT_EQ(kJsepStateStable, mSessionOff.GetState());
+}
+
+TEST_F(JsepSessionTest, SetRemoteAnswerInStable)
+{
+  const std::string answer =
+    "v=0\r\n"
+    "o=Mozilla-SIPUA 4949 0 IN IP4 10.86.255.143\r\n"
+    "s=SIP Call\r\n"
+    "t=0 0\r\n"
+    "a=ice-ufrag:qkEP\r\n"
+    "a=ice-pwd:ed6f9GuHjLcoCN6sC/Eh7fVl\r\n"
+    "m=audio 16384 RTP/AVP 0 8 9 101\r\n"
+    "c=IN IP4 10.86.255.143\r\n"
+    "a=rtpmap:0 PCMU/8000\r\n"
+    "a=rtpmap:8 PCMA/8000\r\n"
+    "a=rtpmap:9 G722/8000\r\n"
+    "a=rtpmap:101 telephone-event/8000\r\n"
+    "a=fmtp:101 0-15\r\n"
+    "a=sendrecv\r\n"
+    "a=candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host\r\n"
+    "a=candidate:2 2 UDP 2130706431 192.168.2.2 50006 typ host\r\n"
+    "m=video 1024 RTP/AVP 97\r\n"
+    "c=IN IP4 10.86.255.143\r\n"
+    "a=rtpmap:120 VP8/90000\r\n"
+    "a=fmtp:97 profile-level-id=42E00C\r\n"
+    "a=sendrecv\r\n"
+    "a=candidate:1 1 UDP 2130706431 192.168.2.3 50007 typ host\r\n"
+    "a=candidate:2 2 UDP 2130706431 192.168.2.4 50008 typ host\r\n";
+
+  // The signaling state will remain "stable" because the
+  // SetRemoteDescription call fails.
+  nsresult rv = mSessionOff.SetRemoteDescription(kJsepSdpAnswer, answer);
+  ASSERT_NE(NS_OK, rv);
+  ASSERT_EQ(kJsepStateStable, mSessionOff.GetState());
+}
+
+TEST_F(JsepSessionTest, SetLocalAnswerInHaveLocalOffer)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+
+  SetLocalOffer(offer);
+  ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
+
+  // The signaling state will remain "have-local-offer" because the
+  // SetLocalDescription call fails.
+  nsresult rv = mSessionOff.SetLocalDescription(kJsepSdpAnswer, offer);
+  ASSERT_NE(NS_OK, rv);
+  ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
+}
+
+TEST_F(JsepSessionTest, SetRemoteOfferInHaveLocalOffer)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+
+  SetLocalOffer(offer);
+  ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
+
+  // The signaling state will remain "have-local-offer" because the
+  // SetRemoteDescription call fails.
+  nsresult rv = mSessionOff.SetRemoteDescription(kJsepSdpOffer, offer);
+  ASSERT_NE(NS_OK, rv);
+  ASSERT_EQ(kJsepStateHaveLocalOffer, mSessionOff.GetState());
+}
+
+TEST_F(JsepSessionTest, SetLocalOfferInHaveRemoteOffer)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+
+  SetRemoteOffer(offer);
+  ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
+
+  // The signaling state will remain "have-remote-offer" because the
+  // SetLocalDescription call fails.
+  nsresult rv = mSessionAns.SetLocalDescription(kJsepSdpOffer, offer);
+  ASSERT_NE(NS_OK, rv);
+  ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
+}
+
+TEST_F(JsepSessionTest, SetRemoteAnswerInHaveRemoteOffer)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  std::string offer = CreateOffer();
+
+  SetRemoteOffer(offer);
+  ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
+
+  // The signaling state will remain "have-remote-offer" because the
+  // SetRemoteDescription call fails.
+  nsresult rv = mSessionAns.SetRemoteDescription(kJsepSdpAnswer, offer);
+  ASSERT_NE(NS_OK, rv);
+
+  ASSERT_EQ(kJsepStateHaveRemoteOffer, mSessionAns.GetState());
+}
+
+TEST_F(JsepSessionTest, RtcpFbInOffer)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+  std::string offer = CreateOffer();
+
+  std::map<std::string, bool> expected;
+  expected["nack"] = false;
+  expected["nack pli"] = false;
+  expected["ccm fir"] = false;
+
+  size_t prev = 0;
+  size_t found = 0;
+  for(;;) {
+    found = offer.find('\n', found + 1);
+    if (found == std::string::npos)
+      break;
+
+    std::string line = offer.substr(prev, (found - prev));
+
+    // ensure no other rtcp-fb values are present
+    if (line.find("a=rtcp-fb:") != std::string::npos) {
+      size_t space = line.find(' ');
+      //strip trailing \r\n
+      std::string value = line.substr(space + 1, line.length() - space - 2);
+      std::map<std::string, bool>::iterator entry = expected.find(value);
+      ASSERT_NE(entry, expected.end());
+      entry->second = true;
+    }
+
+    prev = found + 1;
+  }
+
+  // ensure all values are present
+  for (std::map<std::string, bool>::iterator it = expected.begin(); it != expected.end(); ++it) {
+    ASSERT_EQ(it->second, true);
+  }
+}
+
+// In this test we will change the offer SDP's a=setup value
+// from actpass to passive.  This will make the answer do active.
+TEST_F(JsepSessionTest, AudioCallForceDtlsRoles)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string actpass = "\r\na=setup:actpass";
+  size_t match = offer.find(actpass);
+  ASSERT_NE(match, std::string::npos);
+  offer.replace(match, actpass.length(), "\r\na=setup:passive");
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  match = answer.find("\r\na=setup:active");
+  ASSERT_NE(match, std::string::npos);
+}
+
+// In this test we will change the offer SDP's a=setup value
+// from actpass to active.  This will make the answer do passive
+TEST_F(JsepSessionTest, AudioCallReverseDtlsRoles)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string actpass = "\r\na=setup:actpass";
+  size_t match = offer.find(actpass);
+  ASSERT_NE(match, std::string::npos);
+  offer.replace(match, actpass.length(), "\r\na=setup:active");
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  match = answer.find("\r\na=setup:passive");
+  ASSERT_NE(match, std::string::npos);
+}
+
+// In this test we will change the answer SDP's a=setup value
+// from active to passive.  This will make both sides do
+// active and should not connect.
+TEST_F(JsepSessionTest, AudioCallMismatchDtlsRoles)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string actpass = "\r\na=setup:actpass";
+  size_t match = offer.find(actpass);
+  ASSERT_NE(match, std::string::npos);
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  std::string active = "\r\na=setup:active";
+  match = answer.find(active);
+  ASSERT_NE(match, std::string::npos);
+  SetLocalAnswer(answer);
+  answer.replace(match, active.length(), "\r\na=setup:passive");
+  SetRemoteAnswer(answer);
+}
+
+// In this test we will change the offer SDP's a=setup value
+// from actpass to garbage.  It should ignore the garbage value
+// and respond with setup:active
+TEST_F(JsepSessionTest, AudioCallGarbageSetup)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string actpass = "\r\na=setup:actpass";
+  size_t match = offer.find(actpass);
+  ASSERT_NE(match, std::string::npos);
+  offer.replace(match, actpass.length(), "\r\na=setup:G4rb4g3V4lu3");
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  match = answer.find("\r\na=setup:active");
+  ASSERT_NE(match, std::string::npos);
+}
+
+// In this test we will change the offer SDP to remove the
+// a=setup line.  Answer should respond with a=setup:active.
+TEST_F(JsepSessionTest, AudioCallOfferNoSetupOrConnection)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  std::string actpass = "\r\na=setup:actpass";
+  size_t match = offer.find(actpass);
+  ASSERT_NE(match, std::string::npos);
+  offer.replace(match, actpass.length(), "");
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  match = answer.find("\r\na=setup:active");
+  ASSERT_NE(match, std::string::npos);
+}
+
+// In this test we will change the answer SDP to remove the
+// a=setup line. TODO: This used to be a signaling test so it also tested that
+// ICE would still connect since active would be assumed.
+TEST_F(JsepSessionTest, AudioCallAnswerNoSetupOrConnection)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+  std::string offer = CreateOffer();
+  size_t match = offer.find("\r\na=setup:actpass");
+  ASSERT_NE(match, std::string::npos);
+
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  std::string active = "\r\na=setup:active";
+  match = answer.find(active);
+  ASSERT_NE(match, std::string::npos);
+  answer.replace(match, active.length(), "");
+  SetLocalAnswer(answer);
+  SetRemoteAnswer(answer);
+}
+
+// Remove H.264 P1 and VP8 from offer, check answer negotiates H.264 P0
+TEST_F(JsepSessionTest, OfferWithOnlyH264P0)
+{
+  for (JsepCodecDescription* codec : mSessionOff.Codecs()) {
+    if (codec->mName != "H264" || codec->mDefaultPt == "126") {
+      codec->mEnabled = false;
+    }
+  }
+
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+  AddTracks(mSessionAns, "audio,video");
+  std::string offer = CreateOffer();
+
+  ASSERT_EQ(offer.find("a=rtpmap:126 H264/90000"), std::string::npos);
+  ASSERT_EQ(offer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
+
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+  std::string answer = CreateAnswer();
+  size_t match = answer.find("\r\na=setup:active");
+  ASSERT_NE(match, std::string::npos);
+
+  // validate answer SDP
+  ASSERT_NE(answer.find("a=rtpmap:97 H264/90000"), std::string::npos);
+  ASSERT_NE(answer.find("a=rtcp-fb:97 nack"), std::string::npos);
+  ASSERT_NE(answer.find("a=rtcp-fb:97 nack pli"), std::string::npos);
+  ASSERT_NE(answer.find("a=rtcp-fb:97 ccm fir"), std::string::npos);
+  // Ensure VP8 and P1 removed
+  ASSERT_EQ(answer.find("a=rtpmap:126 H264/90000"), std::string::npos);
+  ASSERT_EQ(answer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
+  ASSERT_EQ(answer.find("a=rtcp-fb:120"), std::string::npos);
+  ASSERT_EQ(answer.find("a=rtcp-fb:126"), std::string::npos);
+}
+
+// Test negotiating an answer which has only H.264 P1
+// Which means replace VP8 with H.264 P1 in answer
+TEST_F(JsepSessionTest, AnswerWithoutVP8)
+{
+  types.push_back(SdpMediaSection::kAudio);
+  types.push_back(SdpMediaSection::kVideo);
+  AddTracks(mSessionOff, "audio,video");
+  AddTracks(mSessionAns, "audio,video");
+  std::string offer = CreateOffer();
+  SetLocalOffer(offer);
+  SetRemoteOffer(offer);
+
+  for (JsepCodecDescription* codec : mSessionOff.Codecs()) {
+    if (codec->mName != "H264" || codec->mDefaultPt == "126") {
+      codec->mEnabled = false;
+    }
+  }
+
+  std::string answer = CreateAnswer();
+
+  SetLocalAnswer(answer);
+  SetRemoteAnswer(answer);
+}
+
 } // namespace mozilla
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -2242,88 +2242,16 @@ TEST_P(SignalingTest, CreateSetOffer)
 }
 
 TEST_P(SignalingTest, CreateOfferAudioVideoOptionUndefined)
 {
   OfferOptions options;
   CreateOffer(options, OFFER_AV);
 }
 
-TEST_P(SignalingTest, CreateOfferNoVideoStreamRecvVideo)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  CreateOffer(options, OFFER_AUDIO);
-}
-
-TEST_P(SignalingTest, CreateOfferNoAudioStreamRecvAudio)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  CreateOffer(options, OFFER_VIDEO);
-}
-
-TEST_P(SignalingTest, CreateOfferNoVideoStream)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 0);
-  CreateOffer(options, OFFER_AUDIO);
-}
-
-TEST_P(SignalingTest, CreateOfferNoAudioStream)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 0);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  CreateOffer(options, OFFER_VIDEO);
-}
-
-TEST_P(SignalingTest, CreateOfferDontReceiveAudio)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 0);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  CreateOffer(options, OFFER_AV);
-}
-
-TEST_P(SignalingTest, CreateOfferDontReceiveVideo)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 0);
-  CreateOffer(options, OFFER_AV);
-}
-
-TEST_P(SignalingTest, CreateOfferRemoveAudioTrack)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  CreateOfferRemoveTrack(options, false);
-}
-
-TEST_P(SignalingTest, CreateOfferDontReceiveAudioRemoveAudioTrack)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 0);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  CreateOfferRemoveTrack(options, false);
-}
-
-TEST_P(SignalingTest, CreateOfferDontReceiveVideoRemoveVideoTrack)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 0);
-  CreateOfferRemoveTrack(options, true);
-}
-
 TEST_P(SignalingTest, OfferAnswerNothingDisabled)
 {
   OfferOptions options;
   OfferAnswer(options, OFFER_AV | ANSWER_AV);
 }
 
 TEST_P(SignalingTest, OfferAnswerNoTrickle)
 {
@@ -2379,54 +2307,16 @@ TEST_P(SignalingTest, OfferAnswerVideoIn
 {
   OfferOptions options;
   options.setInt32Option("OfferToReceiveAudio", 1);
   options.setInt32Option("OfferToReceiveVideo", 1);
   OfferAnswer(options, OFFER_AUDIO | ANSWER_AUDIO);
   CloseStreams();
 }
 
-TEST_P(SignalingTest, CreateOfferAddCandidate)
-{
-  OfferOptions options;
-  CreateOfferAddCandidate(options, strSampleCandidate,
-                          strSampleMid, nSamplelevel);
-}
-
-TEST_P(SignalingTest, AddIceCandidateEarly)
-{
-  OfferOptions options;
-  AddIceCandidateEarly(strSampleCandidate,
-                       strSampleMid, nSamplelevel);
-}
-
-TEST_P(SignalingTest, OfferAnswerDontAddAudioStreamOnAnswerNoOptions)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  OfferAnswer(options, OFFER_AV | ANSWER_VIDEO);
-}
-
-TEST_P(SignalingTest, OfferAnswerDontAddVideoStreamOnAnswerNoOptions)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  OfferAnswer(options, OFFER_AV | ANSWER_AUDIO);
-}
-
-TEST_P(SignalingTest, OfferAnswerDontAddAudioVideoStreamsOnAnswerNoOptions)
-{
-  OfferOptions options;
-  options.setInt32Option("OfferToReceiveAudio", 1);
-  options.setInt32Option("OfferToReceiveVideo", 1);
-  OfferAnswer(options, OFFER_AV | ANSWER_NONE);
-}
-
 TEST_P(SignalingTest, RenegotiationOffererAddsTracks)
 {
   OfferOptions options;
   OfferAnswer(options, OFFER_AV | ANSWER_AV);
   // OFFER_AV causes a new stream + tracks to be added
   OfferAnswer(options, OFFER_AV);
   CloseStreams();
 }
@@ -2454,29 +2344,16 @@ TEST_P(SignalingTest, RenegotiationBothR
   OfferAnswer(options, OFFER_NONE);
 
   // OFFER_AUDIO causes a new audio track to be added on both sides
   OfferAnswer(options, OFFER_AUDIO);
 
   CloseStreams();
 }
 
-TEST_P(SignalingTest, RenegotiationOffererReplacesTrack)
-{
-  OfferOptions options;
-  OfferAnswer(options, OFFER_AV | ANSWER_AV);
-
-  a1_->RemoveTrack(0, false);
-
-  // OFFER_AUDIO causes a new audio track to be added on both sides
-  OfferAnswer(options, OFFER_AUDIO);
-
-  CloseStreams();
-}
-
 TEST_P(SignalingTest, RenegotiationOffererSwapsMsids)
 {
   OfferOptions options;
 
   EnsureInit();
   a1_->AddStream(DOMMediaStream::HINT_CONTENTS_AUDIO |
                  DOMMediaStream::HINT_CONTENTS_VIDEO);
 
@@ -2563,41 +2440,16 @@ TEST_P(SignalingTest, FullCallAudioOnly)
 TEST_P(SignalingTest, FullCallVideoOnly)
 {
   OfferOptions options;
   OfferAnswer(options, OFFER_VIDEO | ANSWER_VIDEO);
 
   CloseStreams();
 }
 
-TEST_P(SignalingTest, OfferAndAnswerWithExtraCodec)
-{
-  EnsureInit();
-  OfferOptions options;
-  Offer(options, OFFER_AUDIO);
-
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-  ParsedSDP sdpWrapper(a2_->answer());
-  sdpWrapper.ReplaceLine("m=audio",
-                         "m=audio 65375 UDP/TLS/RTP/SAVPF 109 8\r\n");
-  sdpWrapper.AddLine("a=rtpmap:8 PCMA/8000\r\n");
-  std::cout << "Modified SDP " << std::endl
-            << indent(sdpWrapper.getSdp()) << std::endl;
-
-  a1_->SetRemote(TestObserver::ANSWER, sdpWrapper.getSdp());
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
 TEST_P(SignalingTest, FullCallTrickle)
 {
   OfferOptions options;
   OfferAnswer(options, OFFER_AV | ANSWER_AV);
 
   std::cerr << "ICE handshake completed" << std::endl;
 
   CloseStreams();
@@ -2631,48 +2483,16 @@ TEST_P(SignalingTest, FullCallTrickleBef
   CheckPipelines();
   CheckStreams();
 
   std::cerr << "ICE handshake completed" << std::endl;
 
   CloseStreams();
 }
 
-// This test comes from Bug 810220
-// TODO: Move this to jsep_session_unittest
-TEST_P(SignalingTest, AudioOnlyG711Call)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  const std::string& offer(strG711SdpOffer);
-
-  std::cout << "Setting offer to:" << std::endl << indent(offer) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, offer);
-
-  std::cout << "Creating answer:" << std::endl;
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  std::string answer = a2_->answer();
-
-  // They didn't offer opus, so our answer shouldn't include it.
-  ASSERT_EQ(answer.find(" opus/"), std::string::npos);
-
-  // They also didn't offer video or application
-  ASSERT_EQ(answer.find("video"), std::string::npos);
-  ASSERT_EQ(answer.find("application"), std::string::npos);
-
-  // We should answer with PCMU and telephone-event
-  ASSERT_NE(answer.find(" PCMU/8000"), std::string::npos);
-
-  // Double-check the directionality
-  ASSERT_NE(answer.find("\r\na=sendrecv"), std::string::npos);
-
-}
-
 TEST_P(SignalingTest, IncomingOfferIceLite)
 {
   EnsureInit();
 
   std::string offer =
     "v=0\r\n"
     "o=- 1936463 1936463 IN IP4 148.147.200.251\r\n"
     "s=-\r\n"
@@ -2855,255 +2675,16 @@ TEST_P(SignalingTest, FullChromeHandshak
 
   std::cout << "Setting answer" << std::endl;
   a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
 
   std::string answer = a2_->answer();
   ASSERT_NE(answer.find("111 opus/"), std::string::npos);
 }
 
-// Disabled pending resolution of bug 818640.
-// Actually, this test is completely broken; you can't just call
-// SetRemote/CreateAnswer over and over again.
-// If we were to test this sort of thing, it would belong in
-// jsep_session_unitest
-TEST_P(SignalingTest, DISABLED_OfferAllDynamicTypes)
-{
-  EnsureInit();
-
-  std::string offer;
-  for (int i = 96; i < 128; i++)
-  {
-    std::stringstream ss;
-    ss << i;
-    std::cout << "Trying dynamic pt = " << i << std::endl;
-    offer =
-      "v=0\r\n"
-      "o=- 1 1 IN IP4 148.147.200.251\r\n"
-      "s=-\r\n"
-      "b=AS:64\r\n"
-      "t=0 0\r\n"
-      "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
-        "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
-      "m=audio 9000 RTP/AVP " + ss.str() + "\r\n"
-      "c=IN IP4 148.147.200.251\r\n"
-      "b=TIAS:64000\r\n"
-      "a=rtpmap:" + ss.str() +" opus/48000/2\r\n"
-      "a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
-      "a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
-      "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
-      "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
-      "a=sendrecv\r\n";
-
-      /*
-      std::cout << "Setting offer to:" << std::endl
-                << indent(offer) << std::endl;
-      */
-      a2_->SetRemote(TestObserver::OFFER, offer);
-
-      //std::cout << "Creating answer:" << std::endl;
-      a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-      std::string answer = a2_->answer();
-
-      ASSERT_NE(answer.find(ss.str() + " opus/"), std::string::npos);
-  }
-
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, ipAddrAnyOffer)
-{
-  EnsureInit();
-
-  std::string offer =
-    "v=0\r\n"
-    "o=- 1 1 IN IP4 127.0.0.1\r\n"
-    "s=-\r\n"
-    "b=AS:64\r\n"
-    "t=0 0\r\n"
-    "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
-      "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
-    "m=audio 9000 RTP/AVP 99\r\n"
-    "c=IN IP4 0.0.0.0\r\n"
-    "a=rtpmap:99 opus/48000/2\r\n"
-    "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
-    "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
-    "a=setup:active\r\n"
-    "a=sendrecv\r\n";
-
-    a2_->SetRemote(TestObserver::OFFER, offer);
-    ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateSuccess);
-    a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-    ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateSuccess);
-    std::string answer = a2_->answer();
-    ASSERT_NE(answer.find("a=sendrecv"), std::string::npos);
-}
-
-static void CreateSDPForBigOTests(std::string& offer, const std::string& number) {
-  offer =
-    "v=0\r\n"
-    "o=- ";
-  offer += number;
-  offer += " ";
-  offer += number;
-  offer += " IN IP4 127.0.0.1\r\n"
-    "s=-\r\n"
-    "b=AS:64\r\n"
-    "t=0 0\r\n"
-    "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
-      "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
-    "m=audio 9000 RTP/AVP 99\r\n"
-    "c=IN IP4 0.0.0.0\r\n"
-    "a=rtpmap:99 opus/48000/2\r\n"
-    "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
-    "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
-    "a=setup:active\r\n"
-    "a=sendrecv\r\n";
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, BigOValues)
-{
-  EnsureInit();
-
-  std::string offer;
-
-  CreateSDPForBigOTests(offer, "12345678901234567");
-
-  a2_->SetRemote(TestObserver::OFFER, offer);
-  ASSERT_EQ(a2_->pObserver->state, TestObserver::stateSuccess);
-}
-
-// TODO: Move to jsep_session_unittest
-// We probably need to retain at least one test case for each API entry point
-// that verifies that errors are propagated correctly, though.
-TEST_P(SignalingTest, BigOValuesExtraChars)
-{
-  EnsureInit();
-
-  std::string offer;
-
-  CreateSDPForBigOTests(offer, "12345678901234567FOOBAR");
-
-  // The signaling state will remain "stable" because the unparsable
-  // SDP leads to a failure in SetRemoteDescription.
-  a2_->SetRemote(TestObserver::OFFER, offer, true,
-                 PCImplSignalingState::SignalingStable);
-  ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateError);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, BigOValuesTooBig)
-{
-  EnsureInit();
-
-  std::string offer;
-
-  CreateSDPForBigOTests(offer, "18446744073709551615");
-
-  // The signaling state will remain "stable" because the unparsable
-  // SDP leads to a failure in SetRemoteDescription.
-  a2_->SetRemote(TestObserver::OFFER, offer, true,
-                 PCImplSignalingState::SignalingStable);
-  ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateError);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, SetLocalAnswerInStable)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  CreateOffer(options, OFFER_AUDIO);
-
-  // The signaling state will remain "stable" because the
-  // SetLocalDescription call fails.
-  a1_->SetLocal(TestObserver::ANSWER, a1_->offer(), true,
-                PCImplSignalingState::SignalingStable);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kInvalidState);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, SetRemoteAnswerInStable) {
-  EnsureInit();
-
-  // The signaling state will remain "stable" because the
-  // SetRemoteDescription call fails.
-  a1_->SetRemote(TestObserver::ANSWER, strSampleSdpAudioVideoNoIce, true,
-                PCImplSignalingState::SignalingStable);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kInvalidState);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, SetLocalAnswerInHaveLocalOffer) {
-  OfferOptions options;
-  CreateOffer(options, OFFER_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kNoError);
-
-  // The signaling state will remain "have-local-offer" because the
-  // SetLocalDescription call fails.
-  a1_->SetLocal(TestObserver::ANSWER, a1_->offer(), true,
-                PCImplSignalingState::SignalingHaveLocalOffer);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kInvalidState);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, SetRemoteOfferInHaveLocalOffer) {
-  OfferOptions options;
-  CreateOffer(options, OFFER_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kNoError);
-
-  // The signaling state will remain "have-local-offer" because the
-  // SetRemoteDescription call fails.
-  a1_->SetRemote(TestObserver::OFFER, a1_->offer(), true,
-                 PCImplSignalingState::SignalingHaveLocalOffer);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kInvalidState);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, SetLocalOfferInHaveRemoteOffer) {
-  OfferOptions options;
-  CreateOffer(options, OFFER_AUDIO);
-  a2_->SetRemote(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kNoError);
-
-  // The signaling state will remain "have-remote-offer" because the
-  // SetLocalDescription call fails.
-  a2_->SetLocal(TestObserver::OFFER, a1_->offer(), true,
-                PCImplSignalingState::SignalingHaveRemoteOffer);
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kInvalidState);
-}
-
-// TODO: Move to jsep_session_unittest
-TEST_P(SignalingTest, SetRemoteAnswerInHaveRemoteOffer) {
-  OfferOptions options;
-  CreateOffer(options, OFFER_AUDIO);
-  a2_->SetRemote(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kNoError);
-
-  // The signaling state will remain "have-remote-offer" because the
-  // SetRemoteDescription call fails.
-  a2_->SetRemote(TestObserver::ANSWER, a1_->offer(), true,
-               PCImplSignalingState::SignalingHaveRemoteOffer);
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kInvalidState);
-}
-
 // Disabled until the spec adds a failure callback to addStream
 // Actually, this is allowed I think, it just triggers a negotiationneeded
 TEST_P(SignalingTest, DISABLED_AddStreamInHaveLocalOffer) {
   OfferOptions options;
   CreateOffer(options, OFFER_AUDIO);
   a1_->SetLocal(TestObserver::OFFER, a1_->offer());
   ASSERT_EQ(a1_->pObserver->lastStatusCode,
             PeerConnectionImpl::kNoError);
@@ -3120,67 +2701,23 @@ TEST_P(SignalingTest, DISABLED_RemoveStr
   a1_->SetLocal(TestObserver::OFFER, a1_->offer());
   ASSERT_EQ(a1_->pObserver->lastStatusCode,
             PeerConnectionImpl::kNoError);
   a1_->RemoveLastStreamAdded();
   ASSERT_EQ(a1_->pObserver->lastStatusCode,
             PeerConnectionImpl::kInvalidState);
 }
 
-TEST_P(SignalingTest, AddCandidateInHaveLocalOffer) {
-  OfferOptions options;
-  CreateOffer(options, OFFER_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastAddIceStatusCode,
-            PeerConnectionImpl::kNoError);
-  a1_->AddIceCandidate(strSampleCandidate,
-                      strSampleMid, nSamplelevel, false);
-  ASSERT_EQ(PeerConnectionImpl::kInvalidState,
-            a1_->pObserver->lastAddIceStatusCode);
-}
-
 TEST_F(SignalingAgentTest, CreateOffer) {
   CreateAgent(TestStunServer::GetInstance()->addr(),
               TestStunServer::GetInstance()->port());
   OfferOptions options;
   agent(0)->CreateOffer(options, OFFER_AUDIO);
 }
 
-TEST_F(SignalingAgentTest, SetLocalWithoutCreateOffer) {
-  CreateAgent(TestStunServer::GetInstance()->addr(),
-              TestStunServer::GetInstance()->port());
-  CreateAgent(TestStunServer::GetInstance()->addr(),
-              TestStunServer::GetInstance()->port());
-  OfferOptions options;
-  agent(0)->CreateOffer(options, OFFER_AUDIO);
-  agent(1)->SetLocal(TestObserver::OFFER,
-                     agent(0)->offer(),
-                     true,
-                     PCImplSignalingState::SignalingStable);
-}
-
-TEST_F(SignalingAgentTest, SetLocalWithoutCreateAnswer) {
-  CreateAgent(TestStunServer::GetInstance()->addr(),
-              TestStunServer::GetInstance()->port());
-  CreateAgent(TestStunServer::GetInstance()->addr(),
-              TestStunServer::GetInstance()->port());
-  CreateAgent(TestStunServer::GetInstance()->addr(),
-              TestStunServer::GetInstance()->port());
-  OfferOptions options;
-  agent(0)->CreateOffer(options, OFFER_AUDIO);
-  agent(1)->SetRemote(TestObserver::OFFER, agent(0)->offer());
-  agent(1)->CreateAnswer(ANSWER_AUDIO);
-  agent(2)->SetRemote(TestObserver::OFFER, agent(0)->offer());
-  // Use agent 1's answer on agent 2, should fail
-  agent(2)->SetLocal(TestObserver::ANSWER,
-                     agent(1)->answer(),
-                     true,
-                     PCImplSignalingState::SignalingHaveRemoteOffer);
-}
-
 TEST_F(SignalingAgentTest, CreateOfferSetLocalTrickleTestServer) {
   TestStunServer::GetInstance()->SetActive(false);
   TestStunServer::GetInstance()->SetResponseAddr(
       kBogusSrflxAddress, kBogusSrflxPort);
 
   CreateAgent(
       TestStunServer::GetInstance()->addr(),
       TestStunServer::GetInstance()->port());
@@ -3201,17 +2738,16 @@ TEST_F(SignalingAgentTest, CreateOfferSe
   ASSERT_LE(2U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
 
   // Verify that the candidates appear in the offer.
   size_t match;
   match = agent(0)->getLocalDescription().find(kBogusSrflxAddress);
   ASSERT_LT(0U, match);
 }
 
-
 TEST_F(SignalingAgentTest, CreateAnswerSetLocalTrickleTestServer) {
   TestStunServer::GetInstance()->SetActive(false);
   TestStunServer::GetInstance()->SetResponseAddr(
       kBogusSrflxAddress, kBogusSrflxPort);
 
   CreateAgent(
       TestStunServer::GetInstance()->addr(),
       TestStunServer::GetInstance()->port());
@@ -3237,18 +2773,16 @@ TEST_F(SignalingAgentTest, CreateAnswerS
   ASSERT_LE(2U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
 
   // Verify that the candidates appear in the answer.
   size_t match;
   match = agent(0)->getLocalDescription().find(kBogusSrflxAddress);
   ASSERT_LT(0U, match);
 }
 
-
-
 TEST_F(SignalingAgentTest, CreateLotsAndWait) {
   int i;
 
   for (i=0; i < 100; i++) {
     if (!CreateAgent())
       break;
     std::cerr << "Created agent " << i << std::endl;
   }
@@ -3256,136 +2790,16 @@ TEST_F(SignalingAgentTest, CreateLotsAnd
 }
 
 // Test for bug 856433.
 TEST_F(SignalingAgentTest, CreateNoInit) {
   CreateAgentNoInit();
 }
 
 
-/*
- * Test for Bug 843595
- */
-TEST_P(SignalingTest, missingUfrag)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  std::string offer =
-    "v=0\r\n"
-    "o=Mozilla-SIPUA 2208 0 IN IP4 0.0.0.0\r\n"
-    "s=SIP Call\r\n"
-    "t=0 0\r\n"
-    "a=ice-pwd:4450d5a4a5f097855c16fa079893be18\r\n"
-    "a=fingerprint:sha-256 23:9A:2E:43:94:42:CF:46:68:FC:62:F9:F4:48:61:DB:"
-      "2F:8C:C9:FF:6B:25:54:9D:41:09:EF:83:A8:19:FC:B6\r\n"
-    "m=audio 56187 UDP/TLS/RTP/SAVPF 109 0 8 101\r\n"
-    "c=IN IP4 77.9.79.167\r\n"
-    "a=rtpmap:109 opus/48000/2\r\n"
-    "a=ptime:20\r\n"
-    "a=rtpmap:0 PCMU/8000\r\n"
-    "a=rtpmap:8 PCMA/8000\r\n"
-    "a=rtpmap:101 telephone-event/8000\r\n"
-    "a=fmtp:101 0-15\r\n"
-    "a=sendrecv\r\n"
-    "a=candidate:0 1 UDP 2113601791 192.168.178.20 56187 typ host\r\n"
-    "a=candidate:1 1 UDP 1694236671 77.9.79.167 56187 typ srflx raddr "
-      "192.168.178.20 rport 56187\r\n"
-    "a=candidate:0 2 UDP 2113601790 192.168.178.20 52955 typ host\r\n"
-    "a=candidate:1 2 UDP 1694236670 77.9.79.167 52955 typ srflx raddr "
-      "192.168.178.20 rport 52955\r\n"
-    "m=video 49929 UDP/TLS/RTP/SAVPF 120\r\n"
-    "c=IN IP4 77.9.79.167\r\n"
-    "a=rtpmap:120 VP8/90000\r\n"
-    "a=recvonly\r\n"
-    "a=candidate:0 1 UDP 2113601791 192.168.178.20 49929 typ host\r\n"
-    "a=candidate:1 1 UDP 1694236671 77.9.79.167 49929 typ srflx raddr "
-      "192.168.178.20 rport 49929\r\n"
-    "a=candidate:0 2 UDP 2113601790 192.168.178.20 50769 typ host\r\n"
-    "a=candidate:1 2 UDP 1694236670 77.9.79.167 50769 typ srflx raddr "
-      "192.168.178.20 rport 50769\r\n"
-    "m=application 54054 DTLS/SCTP 5000\r\n"
-    "c=IN IP4 77.9.79.167\r\n"
-    "a=fmtp:HuRUu]Dtcl\\zM,7(OmEU%O$gU]x/z\tD protocol=webrtc-datachannel;"
-      "streams=16\r\n"
-    "a=sendrecv\r\n";
-
-  // Need to create an offer, since that's currently required by our
-  // FSM. This may change in the future.
-  a1_->CreateOffer(options, OFFER_AV);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), true);
-  // We now detect the missing ICE parameters at SetRemoteDescription
-  a2_->SetRemote(TestObserver::OFFER, offer, true,
-                 PCImplSignalingState::SignalingStable);
-  ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateError);
-}
-
-TEST_P(SignalingTest, AudioOnlyCalleeNoRtcpMux)
-{
-  EnsureInit();
-
-  OfferOptions options;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
-  ParsedSDP sdpWrapper(a1_->offer());
-  sdpWrapper.DeleteLine("a=rtcp-mux");
-  std::cout << "Modified SDP " << std::endl
-            << indent(sdpWrapper.getSdp()) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  a1_->mExpectRtcpMuxAudio = false;
-  a2_->mExpectRtcpMuxAudio = false;
-
-  // Answer should not have a=rtcp-mux
-  ASSERT_EQ(a2_->getLocalDescription().find("\r\na=rtcp-mux"),
-            std::string::npos) << "SDP was: " << a2_->getLocalDescription();
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-
-
-TEST_P(SignalingTest, AudioOnlyG722Only)
-{
-  EnsureInit();
-
-  OfferOptions options;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
-  ParsedSDP sdpWrapper(a1_->offer());
-  sdpWrapper.ReplaceLine("m=audio",
-                         "m=audio 65375 UDP/TLS/RTP/SAVPF 9\r\n");
-  std::cout << "Modified SDP " << std::endl
-            << indent(sdpWrapper.getSdp()) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-  ASSERT_NE(a2_->getLocalDescription().find("UDP/TLS/RTP/SAVPF 9\r"),
-            std::string::npos);
-  ASSERT_NE(a2_->getLocalDescription().find("a=rtpmap:9 G722/8000"), std::string::npos);
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
 TEST_P(SignalingTest, AudioOnlyG722MostPreferred)
 {
   EnsureInit();
 
   OfferOptions options;
 
   a1_->CreateOffer(options, OFFER_AUDIO);
   a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
@@ -3403,107 +2817,28 @@ TEST_P(SignalingTest, AudioOnlyG722MostP
   ASSERT_NE(a2_->getLocalDescription().find("a=rtpmap:9 G722/8000"), std::string::npos);
 
   CheckPipelines();
   CheckStreams();
 
   CloseStreams();
 }
 
-TEST_P(SignalingTest, AudioOnlyG722Rejected)
-{
-  EnsureInit();
-
-  OfferOptions options;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-  // creating different SDPs as a workaround for rejecting codecs
-  // this way the answerer should pick a codec with lower priority
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
-  ParsedSDP sdpWrapper(a1_->offer());
-  sdpWrapper.ReplaceLine("m=audio",
-                         "m=audio 65375 UDP/TLS/RTP/SAVPF 0 8\r\n");
-  std::cout << "Modified SDP offer " << std::endl
-            << indent(sdpWrapper.getSdp()) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-  // TODO(bug 814227): Use commented out code instead.
-  ASSERT_NE(a2_->getLocalDescription().find("UDP/TLS/RTP/SAVPF 0\r"),
-            std::string::npos);
-  // ASSERT_NE(a2_->getLocalDescription().find("UDP/TLS/RTP/SAVPF 0 8\r"), std::string::npos);
-  ASSERT_NE(a2_->getLocalDescription().find("a=rtpmap:0 PCMU/8000"), std::string::npos);
-  ASSERT_EQ(a2_->getLocalDescription().find("a=rtpmap:109 opus/48000/2"), std::string::npos);
-  ASSERT_EQ(a2_->getLocalDescription().find("a=rtpmap:9 G722/8000"), std::string::npos);
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
 TEST_P(SignalingTest, RestartIce)
 {
   OfferOptions options;
   OfferAnswer(options, OFFER_AV | ANSWER_AV);
 
   options.setBoolOption("IceRestart", true);
   OfferAnswer(options, OFFER_NONE);
 
   CloseStreams();
 }
 
-TEST_P(SignalingTest, FullCallAudioNoMuxVideoMux)
-{
-  if (UseBundle()) {
-    // This test doesn't make sense for bundle
-    return;
-  }
-
-  EnsureInit();
-
-  OfferOptions options;
-
-  a1_->CreateOffer(options, OFFER_AV);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
-  ParsedSDP sdpWrapper(a1_->offer());
-  sdpWrapper.DeleteLine("a=rtcp-mux");
-  std::cout << "Modified SDP " << std::endl
-            << indent(sdpWrapper.getSdp()) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
-  a2_->CreateAnswer(OFFER_AV | ANSWER_AV);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  // Answer should have only one a=rtcp-mux line
-  size_t match = a2_->getLocalDescription().find("\r\na=rtcp-mux");
-  ASSERT_NE(match, std::string::npos);
-  match = a2_->getLocalDescription().find("\r\na=rtcp-mux", match + 1);
-  ASSERT_EQ(match, std::string::npos);
-
-  a1_->mExpectRtcpMuxAudio = false;
-  a2_->mExpectRtcpMuxAudio = false;
-
-  WaitForCompleted();
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-// TODO: Move to jsep_sesion_unittest
-TEST_P(SignalingTest, RtcpFbInOffer)
-{
-  EnsureInit();
-  OfferOptions options;
-  a1_->CreateOffer(options, OFFER_AV);
-  const char *expected[] = { "nack", "nack pli", "ccm fir" };
-  CheckRtcpFbSdp(a1_->offer(), ARRAY_TO_SET(std::string, expected));
-}
+
 
 TEST_P(SignalingTest, RtcpFbOfferAll)
 {
   const char *feedbackTypes[] = { "nack", "nack pli", "ccm fir" };
   TestRtcpFbOffer(ARRAY_TO_SET(std::string, feedbackTypes),
                   true,
                   VideoSessionConduit::FrameRequestPli);
 }
@@ -3623,283 +2958,16 @@ TEST_P(SignalingTest, RtcpFbAnswerPliOnl
 TEST_P(SignalingTest, RtcpFbAnswerNoFeedback)
 {
   const char *feedbackTypes[] = { };
   TestRtcpFbAnswer(ARRAY_TO_SET(std::string, feedbackTypes),
                   0,
                   VideoSessionConduit::FrameRequestNone);
 }
 
-// In this test we will change the offer SDP's a=setup value
-// from actpass to passive.  This will make the answer do active.
-TEST_P(SignalingTest, AudioCallForceDtlsRoles)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-
-  // By default the offer should give actpass
-  std::string offer(a1_->offer());
-  match = offer.find("\r\na=setup:actpass");
-  ASSERT_NE(match, std::string::npos);
-  // Now replace the actpass with passive so that the answer will
-  // return active
-  offer.replace(match, strlen("\r\na=setup:actpass"),
-    "\r\na=setup:passive");
-  std::cout << "Modified SDP " << std::endl
-            << indent(offer) << std::endl;
-
-  a1_->SetLocal(TestObserver::OFFER, offer, false);
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
-  match = answer.find("\r\na=setup:active");
-  ASSERT_NE(match, std::string::npos);
-
-  // This should setup the DTLS with the same roles
-  // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-// In this test we will change the offer SDP's a=setup value
-// from actpass to active.  This will make the answer do passive
-TEST_P(SignalingTest, AudioCallReverseDtlsRoles)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-
-  // By default the offer should give actpass
-  std::string offer(a1_->offer());
-  match = offer.find("\r\na=setup:actpass");
-  ASSERT_NE(match, std::string::npos);
-  // Now replace the actpass with active so that the answer will
-  // return passive
-  offer.replace(match, strlen("\r\na=setup:actpass"),
-    "\r\na=setup:active");
-  std::cout << "Modified SDP " << std::endl
-            << indent(offer) << std::endl;
-
-  a1_->SetLocal(TestObserver::OFFER, offer, false);
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  // Now the answer should contain a=setup:passive
-  std::string answer(a2_->answer());
-  match = answer.find("\r\na=setup:passive");
-  ASSERT_NE(match, std::string::npos);
-
-  // This should setup the DTLS with the opposite roles
-  // than the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-// In this test we will change the answer SDP's a=setup value
-// from active to passive.  This will make both sides do
-// active and should not connect.
-TEST_P(SignalingTest, AudioCallMismatchDtlsRoles)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-
-  // By default the offer should give actpass
-  std::string offer(a1_->offer());
-  match = offer.find("\r\na=setup:actpass");
-  ASSERT_NE(match, std::string::npos);
-  a1_->SetLocal(TestObserver::OFFER, offer, false);
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
-  match = answer.find("\r\na=setup:active");
-  ASSERT_NE(match, std::string::npos);
-  a2_->SetLocal(TestObserver::ANSWER, answer, false);
-
-  // Now replace the active with passive so that the offerer will
-  // also do active.
-  answer.replace(match, strlen("\r\na=setup:active"),
-    "\r\na=setup:passive");
-  std::cout << "Modified SDP " << std::endl
-            << indent(answer) << std::endl;
-
-  // This should setup the DTLS with both sides playing active
-  a1_->SetRemote(TestObserver::ANSWER, answer, false);
-
-  WaitForCompleted();
-
-  // Not using ASSERT_TRUE_WAIT here because we expect failure
-  PR_Sleep(500); // Wait for some data to get written
-
-  CloseStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 4);
-  // In this case we should receive nothing.
-  ASSERT_EQ(a2_->GetPacketsReceived(0), 0);
-}
-
-// In this test we will change the offer SDP's a=setup value
-// from actpass to garbage.  It should ignore the garbage value
-// and respond with setup:active
-TEST_P(SignalingTest, AudioCallGarbageSetup)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-
-  // By default the offer should give actpass
-  std::string offer(a1_->offer());
-  match = offer.find("\r\na=setup:actpass");
-  ASSERT_NE(match, std::string::npos);
-  // Now replace the actpass with a garbage value
-  offer.replace(match, strlen("\r\na=setup:actpass"),
-    "\r\na=setup:G4rb4g3V4lu3");
-  std::cout << "Modified SDP " << std::endl
-            << indent(offer) << std::endl;
-
-  a1_->SetLocal(TestObserver::OFFER, offer, false);
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
-  match = answer.find("\r\na=setup:active");
-  ASSERT_NE(match, std::string::npos);
-
-  // This should setup the DTLS with the same roles
-  // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-// In this test we will change the offer SDP to remove the
-// a=setup line.  Answer should respond with a=setup:active.
-TEST_P(SignalingTest, AudioCallOfferNoSetupOrConnection)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-
-  std::string offer(a1_->offer());
-  a1_->SetLocal(TestObserver::OFFER, offer, false);
-
-  // By default the offer should give setup:actpass
-  match = offer.find("\r\na=setup:actpass");
-  ASSERT_NE(match, std::string::npos);
-  // Remove the a=setup line
-  offer.replace(match, strlen("\r\na=setup:actpass"), "");
-  std::cout << "Modified SDP " << std::endl
-            << indent(offer) << std::endl;
-
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
-  match = answer.find("\r\na=setup:active");
-  ASSERT_NE(match, std::string::npos);
-
-  // This should setup the DTLS with the same roles
-  // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-// In this test we will change the answer SDP to remove the
-// a=setup line.  ICE should still connect since active will
-// be assumed.
-TEST_P(SignalingTest, AudioCallAnswerNoSetupOrConnection)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AUDIO);
-
-  // By default the offer should give setup:actpass
-  std::string offer(a1_->offer());
-  match = offer.find("\r\na=setup:actpass");
-  ASSERT_NE(match, std::string::npos);
-
-  a1_->SetLocal(TestObserver::OFFER, offer, false);
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AUDIO | ANSWER_AUDIO);
-
-  // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
-  match = answer.find("\r\na=setup:active");
-  ASSERT_NE(match, std::string::npos);
-  // Remove the a=setup line
-  answer.replace(match, strlen("\r\na=setup:active"), "");
-  std::cout << "Modified SDP " << std::endl
-            << indent(answer) << std::endl;
-
-  // This should setup the DTLS with the same roles
-  // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, answer, false);
-  a1_->SetRemote(TestObserver::ANSWER, answer, false);
-
-  WaitForCompleted();
-
-  CheckPipelines();
-  CheckStreams();
-
-  CloseStreams();
-}
-
-
 TEST_P(SignalingTest, FullCallRealTrickle)
 {
   OfferOptions options;
   OfferAnswer(options, OFFER_AV | ANSWER_AV);
   CloseStreams();
 }
 
 TEST_P(SignalingTest, FullCallRealTrickleTestServer)
@@ -4196,146 +3264,16 @@ TEST_P(SignalingTest, OfferWithH264Befor
   // Validate answer SDP
   ASSERT_NE(answer.find("UDP/TLS/RTP/SAVPF 126"), std::string::npos);
   ASSERT_NE(answer.find("a=rtpmap:126 H264/90000"), std::string::npos);
   ASSERT_NE(answer.find("a=rtcp-fb:126 nack"), std::string::npos);
   ASSERT_NE(answer.find("a=rtcp-fb:126 nack pli"), std::string::npos);
   ASSERT_NE(answer.find("a=rtcp-fb:126 ccm fir"), std::string::npos);
 }
 
-#ifdef H264_P0_SUPPORTED
-// Remove H.264 P1 and VP8 from offer, check answer negotiates H.264 P0
-TEST_P(SignalingTest, OfferWithOnlyH264P0)
-{
-  EnsureInit();
-
-  OfferOptions options;
-  size_t match;
-
-  a1_->CreateOffer(options, OFFER_AV);
-
-  // Remove VP8 from offer
-  std::string offer = a1_->offer();
-  match = offer.find("UDP/TLS/RTP/SAVPF 120 126");
-  ASSERT_NE(std::string::npos, match);
-  offer.replace(match,
-                strlen("UDP/TLS/RTP/SAVPF 120 126"),
-                "UDP/TLS/RTP/SAVPF");
-
-  ParsedSDP sdpWrapper(offer);
-  sdpWrapper.DeleteLines("a=rtcp-fb:120");
-  sdpWrapper.DeleteLine("a=rtpmap:120");
-  sdpWrapper.DeleteLines("a=rtcp-fb:126");
-  sdpWrapper.DeleteLine("a=rtpmap:126");
-  sdpWrapper.DeleteLine("a=fmtp:126");
-
-  std::cout << "Modified SDP " << std::endl
-            << indent(sdpWrapper.getSdp()) << std::endl;
-
-  // Offer shouldn't have P1 or VP8 now
-  offer = sdpWrapper.getSdp();
-  ASSERT_EQ(offer.find("a=rtpmap:126 H264/90000"), std::string::npos);
-  ASSERT_EQ(offer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
-
-  // P0 should be offered first
-  ASSERT_NE(offer.find("UDP/TLS/RTP/SAVPF 97"), std::string::npos);
-
-  a1_->SetLocal(TestObserver::OFFER, offer);
-  a2_->SetRemote(TestObserver::OFFER, offer, false);
-  a2_->CreateAnswer(OFFER_AV|ANSWER_AV);
-
-  std::string answer(a2_->answer());
-
-  // validate answer SDP
-  ASSERT_NE(answer.find("UDP/TLS/RTP/SAVPF 97"), std::string::npos);
-  ASSERT_NE(answer.find("a=rtpmap:97 H264/90000"), std::string::npos);
-  ASSERT_NE(answer.find("a=rtcp-fb:97 nack"), std::string::npos);
-  ASSERT_NE(answer.find("a=rtcp-fb:97 nack pli"), std::string::npos);
-  ASSERT_NE(answer.find("a=rtcp-fb:97 ccm fir"), std::string::npos);
-  // Ensure VP8 and P1 removed
-  ASSERT_EQ(answer.find("a=rtpmap:126 H264/90000"), std::string::npos);
-  ASSERT_EQ(answer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
-  ASSERT_EQ(answer.find("a=rtcp-fb:120"), std::string::npos);
-  ASSERT_EQ(answer.find("a=rtcp-fb:126"), std::string::npos);
-}
-#endif
-
-// Test negotiating an answer which has only H.264 P1
-// Which means replace VP8 with H.264 P1 in answer
-TEST_P(SignalingTest, AnswerWithoutVP8)
-{
-  EnsureInit();
-
-  OfferOptions options;
-
-  a1_->CreateOffer(options, OFFER_AV);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  a2_->SetRemote(TestObserver::OFFER, a1_->offer(), false);
-  a2_->CreateAnswer(OFFER_AV|ANSWER_AV);
-
-  std::string answer(a2_->answer());
-
-  // Ensure answer has VP8
-  ASSERT_NE(answer.find("\r\na=rtpmap:120 VP8/90000"), std::string::npos);
-
-  // Replace VP8 with H.264 P1
-  ParsedSDP sdpWrapper(a2_->answer());
-  sdpWrapper.AddLine("a=fmtp:126 profile-level-id=42e00c;level-asymmetry-allowed=1;packetization-mode=1\r\n");
-  size_t match;
-  answer = sdpWrapper.getSdp();
-
-  match = answer.find("UDP/TLS/RTP/SAVPF 120");
-  ASSERT_NE(std::string::npos, match);
-  answer.replace(match,
-                 strlen("UDP/TLS/RTP/SAVPF 120"),
-                 "UDP/TLS/RTP/SAVPF 126");
-
-  match = answer.find("\r\na=rtpmap:120 VP8/90000");
-  ASSERT_NE(std::string::npos, match);
-  answer.replace(match,
-                 strlen("\r\na=rtpmap:126 H264/90000"),
-                 "\r\na=rtpmap:126 H264/90000");
-
-  match = answer.find("\r\na=rtcp-fb:120 nack");
-  ASSERT_NE(std::string::npos, match);
-  answer.replace(match,
-                 strlen("\r\na=rtcp-fb:126 nack"),
-                 "\r\na=rtcp-fb:126 nack");
-
-  match = answer.find("\r\na=rtcp-fb:120 nack pli");
-  ASSERT_NE(std::string::npos, match);
-  answer.replace(match,
-                 strlen("\r\na=rtcp-fb:126 nack pli"),
-                 "\r\na=rtcp-fb:126 nack pli");
-
-  match = answer.find("\r\na=rtcp-fb:120 ccm fir");
-  ASSERT_NE(std::string::npos, match);
-  answer.replace(match,
-                 strlen("\r\na=rtcp-fb:126 ccm fir"),
-                 "\r\na=rtcp-fb:126 ccm fir");
-
-  std::cout << "Modified SDP " << std::endl << indent(answer) << std::endl;
-
-  a2_->SetLocal(TestObserver::ANSWER, answer, false);
-
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kNoError);
-
-  a1_->SetRemote(TestObserver::ANSWER, answer, false);
-
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
-            PeerConnectionImpl::kNoError);
-
-  WaitForCompleted();
-
-  // We cannot check pipelines/streams since the H264 stuff won't init.
-
-  CloseStreams();
-}
-
 // Test using a non preferred dynamic video payload type on answer negotiation
 TEST_P(SignalingTest, UseNonPrefferedPayloadTypeOnAnswer)
 {
   EnsureInit();
 
   OfferOptions options;
   a1_->CreateOffer(options, OFFER_AV);
   a1_->SetLocal(TestObserver::OFFER, a1_->offer());