#include "components/media_router/browser/media_router_dialog_controller.h"
#include <memory>
#include "base/functional/bind.h"
#include "build/build_config.h"
#include "components/media_router/browser/media_router_metrics.h"
#include "components/media_router/browser/presentation/start_presentation_context.h"
#include "components/media_router/common/media_route.h"
#include "components/media_router/common/media_source.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "components/media_router/common/route_request_result.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_ANDROID)
#include "components/media_router/browser/android/media_router_dialog_controller_android.h"
#endif
_;
Return;
namespace media_router {
class TestMediaRouterDialogController : public MediaRouterDialogController { … };
class MockWebContentsDelegate : public content::WebContentsDelegate { … };
class MediaRouterDialogControllerTest
: public content::RenderViewHostTestHarness { … };
#if BUILDFLAG(IS_ANDROID)
TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) {
MediaRouterDialogController::SetGetOrCreate(
base::BindRepeating([](content::WebContents* web_contents) {
DCHECK(web_contents);
MediaRouterDialogController* controller = nullptr;
MediaRouterDialogControllerAndroid::CreateForWebContents(web_contents);
controller =
MediaRouterDialogControllerAndroid::FromWebContents(web_contents);
return controller;
}));
MediaRouterDialogController* dialog_controller =
MediaRouterDialogController::GetOrCreateForWebContents(web_contents());
ASSERT_NE(dialog_controller, nullptr);
ASSERT_EQ(
dialog_controller,
MediaRouterDialogController::GetOrCreateForWebContents(web_contents()));
}
#endif
TEST_F(MediaRouterDialogControllerTest, ShowAndHideDialog) { … }
TEST_F(MediaRouterDialogControllerTest, ShowDialogForPresentation) { … }
TEST_F(MediaRouterDialogControllerTest, StartPresentationContext) { … }
}