From 40854eab23e27bdb7aebd98fb1ecd6198fec97de Mon Sep 17 00:00:00 2001 From: nisse Date: Wed, 22 Mar 2017 03:28:54 -0700 Subject: [PATCH] Reland of Delete class MockCongestionController. (patchset #1 id:1 of https://codereview.webrtc.org/2762133003/ ) Reason for revert: Problem was the rename of the include file. Intend to keep the old name for now, and then reland. Original issue's description: > Revert of Delete class MockCongestionController. (patchset #4 id:60001 of https://codereview.webrtc.org/2762023004/ ) > > Reason for revert: > This is breaking downstream build. > > Original issue's description: > > Delete class MockCongestionController. > > > > It became unused in cl https://codereview.webrtc.org/2516983004. > > > > BUG=None > > > > Review-Url: https://codereview.webrtc.org/2762023004 > > Cr-Commit-Position: refs/heads/master@{#17325} > > Committed: https://chromium.googlesource.com/external/webrtc/+/d19bcb7116d527b5d0b7426468490e72b03358ca > > TBR=stefan@webrtc.org,nisse@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=None > > Review-Url: https://codereview.webrtc.org/2762133003 > Cr-Commit-Position: refs/heads/master@{#17330} > Committed: https://chromium.googlesource.com/external/webrtc/+/e27f1e764ef45f6489cf192de843ca912a05a101 TBR=stefan@webrtc.org,skvlad@webrtc.org BUG=None Review-Url: https://codereview.webrtc.org/2766133002 Cr-Commit-Position: refs/heads/master@{#17338} --- webrtc/audio/audio_send_stream_unittest.cc | 2 +- .../congestion_controller_unittest.cc | 2 +- .../include/mock/mock_congestion_controller.h | 62 ++----------------- .../include/mock/mock_congestion_observer.h | 34 ++++++++++ 4 files changed, 40 insertions(+), 60 deletions(-) create mode 100644 webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc index 98ab9ebca2..74a18bc4bd 100644 --- a/webrtc/audio/audio_send_stream_unittest.cc +++ b/webrtc/audio/audio_send_stream_unittest.cc @@ -18,7 +18,7 @@ #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" #include "webrtc/modules/audio_processing/include/mock_audio_processing.h" -#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h" +#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h" #include "webrtc/modules/congestion_controller/include/send_side_congestion_controller.h" #include "webrtc/modules/pacing/paced_sender.h" #include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" diff --git a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc index 1a794f8b92..8073ae1557 100644 --- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc +++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc @@ -12,7 +12,7 @@ #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" #include "webrtc/modules/congestion_controller/congestion_controller_unittests_helper.h" -#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h" +#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h" #include "webrtc/modules/pacing/mock/mock_paced_sender.h" #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_observer.h" diff --git a/webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h b/webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h index aefb2be7dc..169fa1ce16 100644 --- a/webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h +++ b/webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h @@ -8,66 +8,12 @@ * be found in the AUTHORS file in the root of the source tree. */ +// TODO(nisse): Old include file kept temporarily, to not break +// downstream applications. Delete as soon as downstrem is updated. + #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_CONTROLLER_H_ #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_CONTROLLER_H_ -#include "webrtc/base/constructormagic.h" -#include "webrtc/base/socket.h" -#include "webrtc/common_types.h" -#include "webrtc/modules/congestion_controller/include/congestion_controller.h" -#include "webrtc/test/gmock.h" +#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h" -namespace webrtc { -namespace test { - -class MockCongestionObserver : public CongestionController::Observer { - public: - // TODO(minyue): remove this when old OnNetworkChanged is deprecated. See - // https://bugs.chromium.org/p/webrtc/issues/detail?id=6796 - using CongestionController::Observer::OnNetworkChanged; - - MOCK_METHOD4(OnNetworkChanged, - void(uint32_t bitrate_bps, - uint8_t fraction_loss, - int64_t rtt_ms, - int64_t probing_interval_ms)); -}; - -class MockCongestionController : public CongestionController { - public: - MockCongestionController(Clock* clock, - Observer* observer, - RemoteBitrateObserver* remote_bitrate_observer, - RtcEventLog* event_log, - PacketRouter* packet_router) - : CongestionController(clock, - observer, - remote_bitrate_observer, - event_log, - packet_router) {} - MOCK_METHOD3(OnReceivedPacket, - void(int64_t arrival_time_ms, - size_t payload_size, - const RTPHeader& header)); - MOCK_METHOD3(SetBweBitrates, - void(int min_bitrate_bps, - int start_bitrate_bps, - int max_bitrate_bps)); - MOCK_METHOD1(SignalNetworkState, void(NetworkState state)); - MOCK_CONST_METHOD0(GetBitrateController, BitrateController*()); - MOCK_METHOD1(GetRemoteBitrateEstimator, - RemoteBitrateEstimator*(bool send_side_bwe)); - MOCK_CONST_METHOD0(GetPacerQueuingDelayMs, int64_t()); - MOCK_METHOD0(pacer, PacedSender*()); - MOCK_METHOD0(GetTransportFeedbackObserver, TransportFeedbackObserver*()); - MOCK_METHOD3(UpdatePacerBitrate, - void(int bitrate_kbps, - int max_bitrate_kbps, - int min_bitrate_kbps)); - MOCK_METHOD1(OnSentPacket, void(const rtc::SentPacket& sent_packet)); - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MockCongestionController); -}; -} // namespace test -} // namespace webrtc #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_CONTROLLER_H_ diff --git a/webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h b/webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h new file mode 100644 index 0000000000..7b4c7f2ecf --- /dev/null +++ b/webrtc/modules/congestion_controller/include/mock/mock_congestion_observer.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_OBSERVER_H_ +#define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_OBSERVER_H_ + +#include "webrtc/base/constructormagic.h" +#include "webrtc/base/socket.h" +#include "webrtc/common_types.h" +#include "webrtc/modules/congestion_controller/include/congestion_controller.h" +#include "webrtc/test/gmock.h" + +namespace webrtc { +namespace test { + +class MockCongestionObserver : public CongestionController::Observer { + public: + MOCK_METHOD4(OnNetworkChanged, + void(uint32_t bitrate_bps, + uint8_t fraction_loss, + int64_t rtt_ms, + int64_t probing_interval_ms)); +}; + +} // namespace test +} // namespace webrtc +#endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_OBSERVER_H_