#include "media/remoting/renderer_controller.h"
#include <memory>
#include <string>
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/limits.h"
#include "media/base/media_util.h"
#include "media/base/test_helpers.h"
#include "media/base/video_decoder_config.h"
#include "media/remoting/fake_remoter.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
namespace remoting {
namespace {
PipelineMetadata DefaultMetadata(VideoCodec codec) { … }
const char kDefaultReceiver[] = …;
mojom::RemotingSinkMetadataPtr GetDefaultSinkMetadata(bool enable) { … }
constexpr base::TimeDelta kDelayedStartDuration = …;
constexpr double frame_rate = …;
constexpr double high_pixel_rate = …;
}
class RendererControllerTest : public ::testing::Test,
public MediaObserverClient { … };
TEST_F(RendererControllerTest, ShouldBeRemotingForDominantVisibleContent) { … }
TEST_F(RendererControllerTest, ShouldBeRemotingForRequestFromBrowser) { … }
TEST_F(RendererControllerTest, ToggleRendererOnDominantChange) { … }
TEST_F(RendererControllerTest, ToggleRendererOnDisableChange) { … }
TEST_F(RendererControllerTest, NotStartForShortContent) { … }
TEST_F(RendererControllerTest, ToggleRendererOnSinkCapabilities) { … }
TEST_F(RendererControllerTest, ToggleRendererOnMediaRemotingRequest) { … }
TEST_F(RendererControllerTest, WithVP9VideoCodec) { … }
TEST_F(RendererControllerTest, WithHEVCVideoCodec) { … }
TEST_F(RendererControllerTest, WithAACAudioCodec) { … }
TEST_F(RendererControllerTest, WithOpusAudioCodec) { … }
TEST_F(RendererControllerTest, StartFailedWithHighPixelRate) { … }
TEST_F(RendererControllerTest, StartSuccessWithHighPixelRate) { … }
TEST_F(RendererControllerTest, PacingTooSlowly) { … }
TEST_F(RendererControllerTest, StartFailed) { … }
TEST_F(RendererControllerTest, SetClientNullptr) { … }
TEST_F(RendererControllerTest, OnFrozen) { … }
#if BUILDFLAG(IS_ANDROID)
TEST_F(RendererControllerTest, RemotePlaybackHlsCompatibility) {
controller_ = FakeRemoterFactory::CreateController(true);
controller_->SetClient(this);
controller_->OnDataSourceInitialized(GURL("http://example.com/foo.m3u8"));
PipelineMetadata incompatible_metadata;
incompatible_metadata.has_video = false;
incompatible_metadata.has_audio = false;
controller_->OnMetadataChanged(incompatible_metadata);
EXPECT_FALSE(is_remote_playback_compatible_);
controller_->OnHlsManifestDetected();
EXPECT_TRUE(is_remote_playback_compatible_);
}
#endif
}
}