#include <stdint.h>
#include <utility>
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/threading/thread_checker.h"
#include "media/base/video_frame.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/web/web_heap.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/renderer/modules/mediastream/mock_encoded_video_frame.h"
#include "third_party/blink/renderer/modules/mediastream/mock_media_stream_video_sink.h"
#include "third_party/blink/renderer/modules/mediastream/mock_media_stream_video_source.h"
#include "third_party/blink/renderer/modules/mediastream/video_track_adapter_settings.h"
#include "third_party/blink/renderer/modules/peerconnection/media_stream_video_webrtc_sink.h"
#include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_source.h"
#include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace media_stream_video_track_test {
RunOnceClosure;
_;
Eq;
InSequence;
Invoke;
Mock;
NiceMock;
Optional;
Return;
StrEq;
Values;
ContentHintType;
const uint8_t kBlackValue = …;
const uint8_t kColorValue = …;
const int kMockSourceWidth = …;
const int kMockSourceHeight = …;
const double kMinFrameRate = …;
class MockEmitLogMessageCb { … };
class MediaStreamVideoTrackTest
: public testing::TestWithParam<ContentHintType> { … };
TEST_F(MediaStreamVideoTrackTest, AddAndRemoveSink) { … }
class CheckThreadHelper { … };
void CheckThreadVideoFrameReceiver(
CheckThreadHelper* helper,
scoped_refptr<media::VideoFrame> frame,
base::TimeTicks estimated_capture_time) { … }
TEST_F(MediaStreamVideoTrackTest, ResetCallbackOnThread) { … }
TEST_F(MediaStreamVideoTrackTest, SetEnabled) { … }
TEST_F(MediaStreamVideoTrackTest, SourceDetached) { … }
TEST_F(MediaStreamVideoTrackTest, SourceStopped) { … }
TEST_F(MediaStreamVideoTrackTest, StopLastTrack) { … }
TEST_F(MediaStreamVideoTrackTest, CheckTrackRequestsFrame) { … }
TEST_F(MediaStreamVideoTrackTest, GetSettings) { … }
TEST_F(MediaStreamVideoTrackTest, GetSettingsWithAdjustment) { … }
TEST_F(MediaStreamVideoTrackTest, GetSettingsStopped) { … }
TEST_F(MediaStreamVideoTrackTest, DeliverFramesAndGetSettings) { … }
TEST_F(MediaStreamVideoTrackTest, FrameStatsIncrementsForEnabledTracks) { … }
TEST_F(MediaStreamVideoTrackTest, DroppedFramesGetLoggedInUMA) { … }
TEST_F(MediaStreamVideoTrackTest,
DroppedFrameLoggingGetsDisabledIfTooManyConsecutiveDropsForSameReason) { … }
TEST_F(MediaStreamVideoTrackTest,
DeliveredFrameInBetweenDroppedFramesResetsCounter) { … }
TEST_F(MediaStreamVideoTrackTest, DeliveredFrameReenablesDroppedFrameLogging) { … }
TEST_F(MediaStreamVideoTrackTest,
ChangeInDropReasonReenablesDroppedFrameLogging) { … }
TEST_F(MediaStreamVideoTrackTest, DroppedFrameCausesLogToBeEmitted) { … }
TEST_F(MediaStreamVideoTrackTest, DroppedFrameEmittedLogEventuallySuppressed) { … }
TEST_F(MediaStreamVideoTrackTest,
DroppedFrameEmittedLogSuppressionOverOneReasonDoesNotAffectAnother) { … }
TEST_F(MediaStreamVideoTrackTest,
DroppedFrameEmittedLogEmittedAtReducedFrequencyIfSuppressed) { … }
TEST_P(MediaStreamVideoTrackTest, PropagatesContentHintType) { … }
TEST_F(MediaStreamVideoTrackTest,
DeliversFramesWithCurrentSubCaptureTargetVersion) { … }
TEST_F(MediaStreamVideoTrackTest,
DropsOldFramesWhenInitializedWithNewerSubCaptureTargetVersion) { … }
TEST_F(MediaStreamVideoTrackTest,
DropsOldFramesAfterSubCaptureTargetVersionChanges) { … }
TEST_F(MediaStreamVideoTrackTest,
DeliversNewFramesAfterSubCaptureTargetVersionChanges) { … }
class MediaStreamVideoTrackEncodedTest : public MediaStreamVideoTrackTest { … };
TEST_F(MediaStreamVideoTrackEncodedTest, ConnectEncodedSink) { … }
TEST_F(MediaStreamVideoTrackEncodedTest, DisconnectEncodedSink) { … }
TEST_F(MediaStreamVideoTrackEncodedTest,
CapturingLinkSecuredWithEncodedAndNormalTracks) { … }
TEST_F(MediaStreamVideoTrackEncodedTest, TransferOneEncodedVideoFrame) { … }
TEST_F(MediaStreamVideoTrackEncodedTest, SupportsEncodedDisableEnable) { … }
TEST_P(MediaStreamVideoTrackEncodedTest, PropagatesContentHintType) { … }
TEST_F(MediaStreamVideoTrackEncodedTest, SourceStopped) { … }
TEST_F(MediaStreamVideoTrackTest, DeliversConstraintsToKnownSinks) { … }
TEST_F(MediaStreamVideoTrackTest, DeliversConstraintsToNewSinks) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
class MediaStreamVideoTrackRefreshFrameTimerTest
: public MediaStreamVideoTrackTest { … };
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
SetMinFrameRateForScreenCastTrack) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
SetMinFrameRateForNonScreenCastTrack) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest, RequiredRefreshRate) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
RequiredRefreshRateWebRTCSink) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
RequiredRefreshRateMultipleSinksAdded) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
RequiredRefreshRateMultipleSinksAddedAndRemoved) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
NotifyConstraintsStartsTimerIfMinFpsIsSet) { … }
TEST_F(MediaStreamVideoTrackRefreshFrameTimerTest,
NotifyConstraintsDontStartTimerIfMinFpsIsUnset) { … }
}
}