Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc

Issue 2843823002: Fix P2PSocketHostUdp to handle SetOptions() in error state (Closed)
Patch Set: dcheck Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
index 66275114d6109d97c494034129286edbe455f90b..4b68cd519dcc7c3a2af1856f57c407805c2d7df5 100644
--- a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
+++ b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
@@ -281,6 +281,19 @@ TEST_F(P2PSocketHostUdpTest, SendDataNoAuth) {
ASSERT_EQ(sent_packets_.size(), 0U);
}
+// Verify that SetOption() doesn't crash after an error.
+TEST_F(P2PSocketHostUdpTest, SetOptionAfterError) {
+ // Get the sender into the error state.
+ EXPECT_CALL(sender_,
+ Send(MatchMessage(static_cast<uint32_t>(P2PMsg_OnError::ID))))
+ .WillOnce(DoAll(DeleteArg<0>(), Return(true)));
+ socket_host_->Send(dest1_, {1, 2, 3, 4}, rtc::PacketOptions(), 0);
+ testing::Mock::VerifyAndClearExpectations(&sender_);
+
+ // Verify that SetOptions() fails, but doesn't crash.
+ EXPECT_FALSE(socket_host_->SetOption(P2P_SOCKET_OPT_RCVBUF, 2048));
+}
+
// Verify that we can send data after we've received STUN request
// from the other side.
TEST_F(P2PSocketHostUdpTest, SendAfterStunRequest) {
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698