OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1456 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1457 RTCPeerConnectionStats expected("RTCPeerConnection", | 1457 RTCPeerConnectionStats expected("RTCPeerConnection", |
1458 report->timestamp_us()); | 1458 report->timestamp_us()); |
1459 expected.data_channels_opened = 2; | 1459 expected.data_channels_opened = 2; |
1460 expected.data_channels_closed = 1; | 1460 expected.data_channels_closed = 1; |
1461 ASSERT_TRUE(report->Get("RTCPeerConnection")); | 1461 ASSERT_TRUE(report->Get("RTCPeerConnection")); |
1462 EXPECT_EQ(expected, | 1462 EXPECT_EQ(expected, |
1463 report->Get("RTCPeerConnection")->cast_to< | 1463 report->Get("RTCPeerConnection")->cast_to< |
1464 RTCPeerConnectionStats>()); | 1464 RTCPeerConnectionStats>()); |
1465 } | 1465 } |
| 1466 |
| 1467 // Re-opening a data channel (or opening a new data channel that is re-using |
| 1468 // the same address in memory) should increase the opened count. |
| 1469 dummy_channel_b->SignalOpened(dummy_channel_b.get()); |
| 1470 |
| 1471 { |
| 1472 collector_->ClearCachedStatsReport(); |
| 1473 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
| 1474 RTCPeerConnectionStats expected("RTCPeerConnection", |
| 1475 report->timestamp_us()); |
| 1476 expected.data_channels_opened = 3; |
| 1477 expected.data_channels_closed = 1; |
| 1478 ASSERT_TRUE(report->Get("RTCPeerConnection")); |
| 1479 EXPECT_EQ(expected, |
| 1480 report->Get("RTCPeerConnection")->cast_to< |
| 1481 RTCPeerConnectionStats>()); |
| 1482 } |
| 1483 |
| 1484 dummy_channel_a->SignalClosed(dummy_channel_a.get()); |
| 1485 dummy_channel_b->SignalClosed(dummy_channel_b.get()); |
| 1486 |
| 1487 { |
| 1488 collector_->ClearCachedStatsReport(); |
| 1489 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
| 1490 RTCPeerConnectionStats expected("RTCPeerConnection", |
| 1491 report->timestamp_us()); |
| 1492 expected.data_channels_opened = 3; |
| 1493 expected.data_channels_closed = 3; |
| 1494 ASSERT_TRUE(report->Get("RTCPeerConnection")); |
| 1495 EXPECT_EQ(expected, |
| 1496 report->Get("RTCPeerConnection")->cast_to< |
| 1497 RTCPeerConnectionStats>()); |
| 1498 } |
1466 } | 1499 } |
1467 | 1500 |
1468 TEST_F(RTCStatsCollectorTest, | 1501 TEST_F(RTCStatsCollectorTest, |
1469 CollectRTCMediaStreamStatsAndRTCMediaStreamTrackStats_Audio) { | 1502 CollectRTCMediaStreamStatsAndRTCMediaStreamTrackStats_Audio) { |
1470 rtc::scoped_refptr<StreamCollection> local_streams = | 1503 rtc::scoped_refptr<StreamCollection> local_streams = |
1471 StreamCollection::Create(); | 1504 StreamCollection::Create(); |
1472 rtc::scoped_refptr<StreamCollection> remote_streams = | 1505 rtc::scoped_refptr<StreamCollection> remote_streams = |
1473 StreamCollection::Create(); | 1506 StreamCollection::Create(); |
1474 EXPECT_CALL(test_->pc(), local_streams()) | 1507 EXPECT_CALL(test_->pc(), local_streams()) |
1475 .WillRepeatedly(Return(local_streams)); | 1508 .WillRepeatedly(Return(local_streams)); |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 2319 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
2287 }; | 2320 }; |
2288 | 2321 |
2289 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 2322 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
2290 collector_->VerifyThreadUsageAndResultsMerging(); | 2323 collector_->VerifyThreadUsageAndResultsMerging(); |
2291 } | 2324 } |
2292 | 2325 |
2293 } // namespace | 2326 } // namespace |
2294 | 2327 |
2295 } // namespace webrtc | 2328 } // namespace webrtc |
OLD | NEW |