Reland "Rewrite WebRtcSession media tests as PeerConnection tests"

This is a reland of 3df5dcac9b339ba4d3f4969602f094c2c8035b51
Original change's description:
> Rewrite WebRtcSession media tests as PeerConnection tests
> 
> Bug: webrtc:8222
> Change-Id: I782a3227e30de70eb8f6c26a48723cb3510a84ad
> Reviewed-on: https://webrtc-review.googlesource.com/6640
> Commit-Queue: Steve Anton <steveanton@webrtc.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20364}

Bug: webrtc:8222
Change-Id: I0a5398170d469eb9223bc781bfb417a85a72a2d2
Reviewed-on: https://webrtc-review.googlesource.com/14380
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20377}
diff --git a/pc/peerconnectionwrapper.h b/pc/peerconnectionwrapper.h
index 783ae38..f74fcdb 100644
--- a/pc/peerconnectionwrapper.h
+++ b/pc/peerconnectionwrapper.h
@@ -54,54 +54,69 @@
   // resulting SessionDescription once it is available. If the method call
   // failed, null is returned.
   std::unique_ptr<SessionDescriptionInterface> CreateOffer(
-      const PeerConnectionInterface::RTCOfferAnswerOptions& options);
+      const PeerConnectionInterface::RTCOfferAnswerOptions& options,
+      std::string* error_out = nullptr);
   // Calls CreateOffer with default options.
   std::unique_ptr<SessionDescriptionInterface> CreateOffer();
   // Calls CreateOffer and sets a copy of the offer as the local description.
+  std::unique_ptr<SessionDescriptionInterface> CreateOfferAndSetAsLocal(
+      const PeerConnectionInterface::RTCOfferAnswerOptions& options);
+  // Calls CreateOfferAndSetAsLocal with default options.
   std::unique_ptr<SessionDescriptionInterface> CreateOfferAndSetAsLocal();
 
   // Calls the underlying PeerConnection's CreateAnswer method and returns the
   // resulting SessionDescription once it is available. If the method call
   // failed, null is returned.
   std::unique_ptr<SessionDescriptionInterface> CreateAnswer(
-      const PeerConnectionInterface::RTCOfferAnswerOptions& options);
+      const PeerConnectionInterface::RTCOfferAnswerOptions& options,
+      std::string* error_out = nullptr);
   // Calls CreateAnswer with the default options.
   std::unique_ptr<SessionDescriptionInterface> CreateAnswer();
   // Calls CreateAnswer and sets a copy of the offer as the local description.
+  std::unique_ptr<SessionDescriptionInterface> CreateAnswerAndSetAsLocal(
+      const PeerConnectionInterface::RTCOfferAnswerOptions& options);
+  // Calls CreateAnswerAndSetAsLocal with default options.
   std::unique_ptr<SessionDescriptionInterface> CreateAnswerAndSetAsLocal();
 
   // Calls the underlying PeerConnection's SetLocalDescription method with the
   // given session description and waits for the success/failure response.
   // Returns true if the description was successfully set.
-  bool SetLocalDescription(std::unique_ptr<SessionDescriptionInterface> desc);
+  bool SetLocalDescription(std::unique_ptr<SessionDescriptionInterface> desc,
+                           std::string* error_out = nullptr);
   // Calls the underlying PeerConnection's SetRemoteDescription method with the
   // given session description and waits for the success/failure response.
   // Returns true if the description was successfully set.
-  bool SetRemoteDescription(std::unique_ptr<SessionDescriptionInterface> desc);
+  bool SetRemoteDescription(std::unique_ptr<SessionDescriptionInterface> desc,
+                            std::string* error_out = nullptr);
 
-  // Adds a new stream with one audio track to the underlying PeerConnection.
-  void AddAudioStream(const std::string& stream_label,
-                      const std::string& track_label);
-  // Adds a new stream with one video track to the underlying PeerConnection.
-  void AddVideoStream(const std::string& stream_label,
-                      const std::string& track_label);
-  // Adds a new stream with one audio and one video track to the underlying
-  // PeerConnection.
-  void AddAudioVideoStream(const std::string& stream_label,
-                           const std::string& audio_track_label,
-                           const std::string& video_track_label);
+  // Calls the underlying PeerConnection's AddTrack method with an audio media
+  // stream track not bound to any source.
+  rtc::scoped_refptr<RtpSenderInterface> AddAudioTrack(
+      const std::string& track_label,
+      std::vector<MediaStreamInterface*> streams = {});
+
+  // Calls the underlying PeerConnection's AddTrack method with a video media
+  // stream track fed by a fake video capturer.
+  rtc::scoped_refptr<RtpSenderInterface> AddVideoTrack(
+      const std::string& track_label,
+      std::vector<MediaStreamInterface*> streams = {});
+
+  // Returns the signaling state of the underlying PeerConnection.
+  PeerConnectionInterface::SignalingState signaling_state();
 
   // Returns true if ICE has finished gathering candidates.
   bool IsIceGatheringDone();
 
  private:
   std::unique_ptr<SessionDescriptionInterface> CreateSdp(
-      std::function<void(CreateSessionDescriptionObserver*)> fn);
-  bool SetSdp(std::function<void(SetSessionDescriptionObserver*)> fn);
+      std::function<void(CreateSessionDescriptionObserver*)> fn,
+      std::string* error_out);
+  bool SetSdp(std::function<void(SetSessionDescriptionObserver*)> fn,
+              std::string* error_out);
 
   rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
-  rtc::scoped_refptr<PeerConnectionInterface> pc_;
   std::unique_ptr<MockPeerConnectionObserver> observer_;
+  rtc::scoped_refptr<PeerConnectionInterface> pc_;
 };
 
 }  // namespace webrtc