Chromium Code Reviews| Index: talk/app/webrtc/webrtcsession_unittest.cc |
| diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc |
| index c0938d11eaa207b291d4208439c9253acb529e46..bf6205a54dd3f1e3518c853e2765ca4fcc8e32ea 100644 |
| --- a/talk/app/webrtc/webrtcsession_unittest.cc |
| +++ b/talk/app/webrtc/webrtcsession_unittest.cc |
| @@ -3852,6 +3852,36 @@ TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) { |
| EXPECT_EQ(8000, option_val); |
| } |
| +// Test creating a session, request multiple offers, destroy the session |
| +// and make sure we got success/failure callbacks for all of the requests. |
| +// Background: crbug.com/507307 |
| +TEST_F(WebRtcSessionTest, CreateOffersAndShutdown) { |
| + Init(); |
| + |
| + rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observers[100]; |
| + PeerConnectionInterface::RTCOfferAnswerOptions options; |
| + options.offer_to_receive_audio = |
| + RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; |
| + |
| + for (auto& o : observers) { |
| + o = new WebRtcSessionCreateSDPObserverForTest(); |
| + session_->CreateOffer(o, options); |
| + } |
| + |
| + session_.reset(); |
| + // Make sure we process pending messages on the current (signaling) thread |
| + // before checking we we got our callbacks. |
| + rtc::Thread::Current()->ProcessMessages(10); |
|
pbos-webrtc
2015/07/09 09:09:22
Is this long enough to not be flaky? Is it just to
tommi
2015/07/09 09:18:15
All messages will have been posted to the message
|
| + |
| + for (auto& o : observers) { |
| + // We expect to have received a notification now even if the session was |
| + // terminated. The offer creation may or may not have succeeded, but we |
| + // must have received a notification which, so the only invalid state |
| + // is kInit. |
| + EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); |
| + } |
| +} |
| + |
| // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| // currently fails because upon disconnection and reconnection OnIceComplete is |
| // called more than once without returning to IceGatheringGathering. |