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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc

Issue 2800633004: Resolve dependency between rtc_event_log_api and remote_bitrate_estimator (Closed)
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/buffer.h" 17 #include "webrtc/base/buffer.h"
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/fakeclock.h" 19 #include "webrtc/base/fakeclock.h"
20 #include "webrtc/base/random.h" 20 #include "webrtc/base/random.h"
21 #include "webrtc/call/call.h" 21 #include "webrtc/call/call.h"
22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
23 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" 23 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
24 #include "webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h" 24 #include "webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h"
25 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor.h" 25 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor.h"
26 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
31 #include "webrtc/test/gtest.h" 32 #include "webrtc/test/gtest.h"
32 #include "webrtc/test/testsupport/fileutils.h" 33 #include "webrtc/test/testsupport/fileutils.h"
33 34
34 // Files generated at build-time by the protobuf compiler. 35 // Files generated at build-time by the protobuf compiler.
35 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 36 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); 554 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
554 const std::string temp_filename = 555 const std::string temp_filename =
555 test::OutputPath() + test_info->test_case_name() + test_info->name(); 556 test::OutputPath() + test_info->test_case_name() + test_info->name();
556 557
557 // Start logging, add the packet delay events and then stop logging. 558 // Start logging, add the packet delay events and then stop logging.
558 rtc::ScopedFakeClock fake_clock; 559 rtc::ScopedFakeClock fake_clock;
559 fake_clock.SetTimeMicros(prng.Rand<uint32_t>()); 560 fake_clock.SetTimeMicros(prng.Rand<uint32_t>());
560 std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create()); 561 std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
561 log_dumper->StartLogging(temp_filename, 10000000); 562 log_dumper->StartLogging(temp_filename, 10000000);
562 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000)); 563 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
563 log_dumper->LogDelayBasedBweUpdate(bitrate1, kBwNormal); 564 log_dumper->LogDelayBasedBweUpdate(bitrate1, BandwidthUsage::kBwNormal);
564 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000)); 565 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
565 log_dumper->LogDelayBasedBweUpdate(bitrate2, kBwOverusing); 566 log_dumper->LogDelayBasedBweUpdate(bitrate2, BandwidthUsage::kBwOverusing);
566 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000)); 567 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
567 log_dumper->LogDelayBasedBweUpdate(bitrate3, kBwUnderusing); 568 log_dumper->LogDelayBasedBweUpdate(bitrate3, BandwidthUsage::kBwUnderusing);
568 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000)); 569 fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
569 log_dumper->StopLogging(); 570 log_dumper->StopLogging();
570 571
571 // Read the generated file from disk. 572 // Read the generated file from disk.
572 ParsedRtcEventLog parsed_log; 573 ParsedRtcEventLog parsed_log;
573 ASSERT_TRUE(parsed_log.ParseFile(temp_filename)); 574 ASSERT_TRUE(parsed_log.ParseFile(temp_filename));
574 575
575 // Verify that what we read back from the event log is the same as 576 // Verify that what we read back from the event log is the same as
576 // what we wrote down. 577 // what we wrote down.
577 EXPECT_EQ(5u, parsed_log.GetNumberOfEvents()); 578 EXPECT_EQ(5u, parsed_log.GetNumberOfEvents());
578 RtcEventLogTestHelper::VerifyLogStartEvent(parsed_log, 0); 579 RtcEventLogTestHelper::VerifyLogStartEvent(parsed_log, 0);
579 RtcEventLogTestHelper::VerifyBweDelayEvent(parsed_log, 1, bitrate1, 580 RtcEventLogTestHelper::VerifyBweDelayEvent(parsed_log, 1, bitrate1,
580 kBwNormal); 581 BandwidthUsage::kBwNormal);
581 RtcEventLogTestHelper::VerifyBweDelayEvent(parsed_log, 2, bitrate2, 582 RtcEventLogTestHelper::VerifyBweDelayEvent(parsed_log, 2, bitrate2,
582 kBwOverusing); 583 BandwidthUsage::kBwOverusing);
583 RtcEventLogTestHelper::VerifyBweDelayEvent(parsed_log, 3, bitrate3, 584 RtcEventLogTestHelper::VerifyBweDelayEvent(parsed_log, 3, bitrate3,
584 kBwUnderusing); 585 BandwidthUsage::kBwUnderusing);
585 RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 4); 586 RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 4);
586 587
587 // Clean up temporary file - can be pretty slow. 588 // Clean up temporary file - can be pretty slow.
588 remove(temp_filename.c_str()); 589 remove(temp_filename.c_str());
589 } 590 }
590 591
591 TEST(RtcEventLogTest, LogProbeClusterCreatedAndReadBack) { 592 TEST(RtcEventLogTest, LogProbeClusterCreatedAndReadBack) {
592 Random prng(794613); 593 Random prng(794613);
593 594
594 int bitrate_bps0 = prng.Rand(0, 10000000); 595 int bitrate_bps0 = prng.Rand(0, 10000000);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 VideoSendConfigReadWriteTest test; 882 VideoSendConfigReadWriteTest test;
882 test.DoTest(); 883 test.DoTest();
883 } 884 }
884 885
885 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) { 886 TEST(RtcEventLogTest, LogAudioNetworkAdaptation) {
886 AudioNetworkAdaptationReadWriteTest test; 887 AudioNetworkAdaptationReadWriteTest test;
887 test.DoTest(); 888 test.DoTest();
888 } 889 }
889 890
890 } // namespace webrtc 891 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log_parser.cc ('k') | webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698