Reland "Set session error if SetLocal/RemoteDescription ever fails"
Original change's description:
> Set session error if SetLocal/RemoteDescription ever fails
>
> This changes SetLocalDescription/SetRemoteDescription to set a
> session error which will cause any future calls to fail early if
> there is an error when applying a session description.
>
> This is needed since until better error recovery is implemented
> failing a call to SetLocalDescription or SetRemoteDescription
> could leave the PeerConnection in an inconsistent state.
>
> Bug: chromium:800775
> Change-Id: If06fd73d6e902af15d072dc562bbe830d3b11ad5
> Reviewed-on: https://webrtc-review.googlesource.com/54061
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22061}
Bug: chromium:800775
Change-Id: I0016108264e013452e9d34239c012baf23240e99
Reviewed-on: https://webrtc-review.googlesource.com/54720
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22067}
diff --git a/rtc_base/gunit.cc b/rtc_base/gunit.cc
index c4631cd..0dd8f12 100644
--- a/rtc_base/gunit.cc
+++ b/rtc_base/gunit.cc
@@ -26,3 +26,16 @@
<< prefix_expr << "\nwhich is\n\"" << prefix << "\"";
}
}
+
+::testing::AssertionResult AssertStringContains(const char* str_expr,
+ const char* substr_expr,
+ const std::string& str,
+ const std::string& substr) {
+ if (str.find(substr) != std::string::npos) {
+ return ::testing::AssertionSuccess();
+ } else {
+ return ::testing::AssertionFailure()
+ << str_expr << "\nwhich is\n\"" << str << "\"\ndoes not contain\n"
+ << substr_expr << "\nwhich is\n\"" << substr << "\"";
+ }
+}