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

Side by Side Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 2682433005: Fix the Chrome crash caused by RtcEventLog (Closed)
Patch Set: Add a unit test. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 3082 matching lines...) Expand 10 before | Expand all | Expand 10 after
3093 // Set local answer. 3093 // Set local answer.
3094 SessionDescriptionInterface* local_answer = webrtc::CreateSessionDescription( 3094 SessionDescriptionInterface* local_answer = webrtc::CreateSessionDescription(
3095 SessionDescriptionInterface::kAnswer, sdp, nullptr); 3095 SessionDescriptionInterface::kAnswer, sdp, nullptr);
3096 EXPECT_TRUE(DoSetLocalDescription(local_answer)); 3096 EXPECT_TRUE(DoSetLocalDescription(local_answer));
3097 EXPECT_EQ(nullptr, pc_->pending_remote_description()); 3097 EXPECT_EQ(nullptr, pc_->pending_remote_description());
3098 EXPECT_EQ(nullptr, pc_->pending_local_description()); 3098 EXPECT_EQ(nullptr, pc_->pending_local_description());
3099 EXPECT_EQ(remote_offer, pc_->current_remote_description()); 3099 EXPECT_EQ(remote_offer, pc_->current_remote_description());
3100 EXPECT_EQ(local_answer, pc_->current_local_description()); 3100 EXPECT_EQ(local_answer, pc_->current_local_description());
3101 } 3101 }
3102 3102
3103 // Tests that it won't crash when calling StartRtcEventLog or StopRtcEventLog
3104 // after the PeerConnection is closed.
3105 TEST_F(PeerConnectionInterfaceTest,
3106 StartAndStopLoggingAfterPeerConnectionClosed) {
3107 CreatePeerConnection();
3108 // The RtcEventLog will be reset when the PeerConnection is closed.
3109 pc_->Close();
3110
3111 rtc::PlatformFile file = 0;
3112 int64_t max_size_bytes = 1024;
3113 EXPECT_FALSE(pc_->StartRtcEventLog(file, max_size_bytes));
3114 pc_->StopRtcEventLog();
3115 }
3116
3103 class PeerConnectionMediaConfigTest : public testing::Test { 3117 class PeerConnectionMediaConfigTest : public testing::Test {
3104 protected: 3118 protected:
3105 void SetUp() override { 3119 void SetUp() override {
3106 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3120 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3107 pcf_->Initialize(); 3121 pcf_->Initialize();
3108 } 3122 }
3109 const cricket::MediaConfig& TestCreatePeerConnection( 3123 const cricket::MediaConfig& TestCreatePeerConnection(
3110 const PeerConnectionInterface::RTCConfiguration& config, 3124 const PeerConnectionInterface::RTCConfiguration& config,
3111 const MediaConstraintsInterface *constraints) { 3125 const MediaConstraintsInterface *constraints) {
3112 pcf_->create_media_controller_called_ = false; 3126 pcf_->create_media_controller_called_ = false;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
3395 EXPECT_NE(a, f); 3409 EXPECT_NE(a, f);
3396 3410
3397 PeerConnectionInterface::RTCConfiguration g; 3411 PeerConnectionInterface::RTCConfiguration g;
3398 g.disable_ipv6 = true; 3412 g.disable_ipv6 = true;
3399 EXPECT_NE(a, g); 3413 EXPECT_NE(a, g);
3400 3414
3401 PeerConnectionInterface::RTCConfiguration h( 3415 PeerConnectionInterface::RTCConfiguration h(
3402 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3416 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3403 EXPECT_NE(a, h); 3417 EXPECT_NE(a, h);
3404 } 3418 }
OLDNEW
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698