#include "chrome/browser/ui/media_router/media_route_starter.h"
#include "base/json/json_reader.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/media/router/test/provider_test_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/session_tab_helper_factory.h"
#include "chrome/browser/ui/global_media_controls/test_helper.h"
#include "chrome/browser/ui/media_router/media_cast_mode.h"
#include "chrome/browser/ui/media_router/query_result_manager.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/media_router/browser/logger_impl.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/media_router/browser/media_sinks_observer.h"
#include "components/media_router/browser/presentation/web_contents_presentation_manager.h"
#include "components/media_router/browser/test/mock_media_router.h"
#include "components/media_router/browser/test/test_helper.h"
#include "components/media_router/common/discovery/media_sink_internal.h"
#include "components/media_router/common/media_sink.h"
#include "components/media_router/common/route_request_result.h"
#include "components/media_router/common/test/test_helper.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/sessions/core/session_id.h"
#include "content/public/browser/presentation_request.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#include "ui/base/cocoa/permissions_utils.h"
#endif
_;
Invoke;
NiceMock;
Return;
namespace media_router {
namespace {
constexpr char kPresentationId[] = …;
constexpr char kLoggerComponent[] = …;
const CastModeSet kDefaultModes = …;
const CastModeSet kMirroringOnly = …;
const CastModeSet kPresentationOnly = …;
const CastModeSet kDestkopMirrorOnly = …;
const CastModeSet kRemotePlaybackOnly = …;
constexpr char kDefaultPresentationUrl[] = …;
constexpr char kDefaultOriginUrl[] = …;
constexpr char kStartPresentationUrl[] = …;
constexpr char kStartOriginUrl[] = …;
constexpr char kRemotePlaybackUrl[] = …;
class MockPresentationRequestSourceObserver
: public PresentationRequestSourceObserver { … };
class PresentationRequestCallbacks { … };
}
class MediaRouteStarterTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(MediaRouteStarterTest, Defaults_NoPresentation) { … }
TEST_F(MediaRouteStarterTest, Defaults_WebContentPresentation) { … }
TEST_F(MediaRouteStarterTest, Defaults_WebContentPresentationOnly) { … }
TEST_F(MediaRouteStarterTest, Defaults_StartPresentationContext) { … }
TEST_F(MediaRouteStarterTest, Defaults_RemotePlayback) { … }
TEST_F(MediaRouteStarterTest, Defaults_NoWebContent) { … }
TEST_F(MediaRouteStarterTest, OnPresentationRequestSourceUpdated) { … }
TEST_F(MediaRouteStarterTest, OnPresentationRequestSourceRemoved) { … }
TEST_F(MediaRouteStarterTest, Dtor_NotFoundError_NoSinks) { … }
TEST_F(MediaRouteStarterTest, Dtor_NotFoundError_NoCompatibleSinks) { … }
TEST_F(MediaRouteStarterTest, Dtor_AbortError) { … }
TEST_F(MediaRouteStarterTest, CreateRouteParameters_NoValidSource) { … }
TEST_F(MediaRouteStarterTest, CreateRouteParameters_DesktopMirroring) { … }
TEST_F(MediaRouteStarterTest, CreateRouteParameters_TabMirroring) { … }
TEST_F(MediaRouteStarterTest, CreateRouteParameters_WebContentPresentation) { … }
TEST_F(MediaRouteStarterTest, CreateRouteParameters_StartPresentationContext) { … }
TEST_F(MediaRouteStarterTest, StartRoute_DesktopMirroring) { … }
TEST_F(MediaRouteStarterTest, StartRoute_DesktopMirroringError) { … }
TEST_F(MediaRouteStarterTest, StartRoute_TabMirroring) { … }
TEST_F(MediaRouteStarterTest, StartRoute_TabMirroringError) { … }
TEST_F(MediaRouteStarterTest, StartRoute_WebContentPresentation) { … }
TEST_F(MediaRouteStarterTest, StartRoute_WebContentPresentationError) { … }
TEST_F(MediaRouteStarterTest, StartRoute_StartPresentationContext_Cast) { … }
TEST_F(MediaRouteStarterTest,
StartRoute_StartPresentationContext_RemotePlayback) { … }
TEST_F(MediaRouteStarterTest, StartRoute_StartPresentationContextError) { … }
TEST_F(MediaRouteStarterTest, GetScreenCapturePermission) { … }
}