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

Unified Diff: content/browser/renderer_host/p2p/socket_host_tcp_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
Index: content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc
index b018b2741ccfbf5c50227f3c0c2b92275b627b22..b15ce468d20bb210cad461ad972939d75ce1dd73 100644
--- a/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc
+++ b/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc
@@ -184,6 +184,19 @@ TEST_F(P2PSocketHostTcpTest, SendDataNoAuth) {
EXPECT_EQ(0U, sent_data_.size());
}
+// Verify that SetOption() doesn't crash after an error.
+TEST_F(P2PSocketHostTcpTest, 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(dest_.ip_address, {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 response
// from the other side.
TEST_F(P2PSocketHostTcpTest, SendAfterStunRequest) {
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.cc ('k') | content/browser/renderer_host/p2p/socket_host_udp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698