#include "chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_test_util.h"
#include "chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h"
#include "chrome/browser/media/router/discovery/mdns/cast_media_sink_service_test_helpers.h"
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
#include "chrome/browser/media/router/test/provider_test_helpers.h"
#include "chrome/browser/search_engines/template_url_service_factory.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_route_starter.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.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/media_router/browser/test/mock_media_router.h"
#include "components/media_router/common/providers/cast/channel/cast_socket.h"
#include "components/media_router/common/providers/cast/channel/cast_socket_service.h"
#include "components/media_router/common/providers/cast/channel/cast_test_util.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/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/sync/test/test_sync_service.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
DiscoveryDevice;
AddSinkResultCode;
MockAddSinkCallback;
MockCastToSinkCallback;
RouteRequestResultCode;
_;
Eq;
Exactly;
InvokeWithoutArgs;
NiceMock;
Return;
StrictMock;
namespace media_router {
namespace {
class MockPage : public access_code_cast::mojom::Page { … };
const char kEmail[] = …;
constexpr char histogram[] = …;
}
class AccessCodeCastHandlerTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(AccessCodeCastHandlerTest, OnSinkAddedResult) { … }
TEST_F(AccessCodeCastHandlerTest, DiscoveredDeviceAdded) { … }
TEST_F(AccessCodeCastHandlerTest, OtherDevicesIgnored) { … }
TEST_F(AccessCodeCastHandlerTest, DesktopMirroring) { … }
TEST_F(AccessCodeCastHandlerTest, DesktopMirroringError) { … }
TEST_F(AccessCodeCastHandlerTest, TabMirroring) { … }
TEST_F(AccessCodeCastHandlerTest, TabMirroringError) { … }
TEST_F(AccessCodeCastHandlerTest, DefaultPresentation) { … }
TEST_F(AccessCodeCastHandlerTest, DefaultPresentationError) { … }
TEST_F(AccessCodeCastHandlerTest, StartPresentationContext) { … }
TEST_F(AccessCodeCastHandlerTest, RouteAlreadyExists) { … }
TEST_F(AccessCodeCastHandlerTest, ProfileSyncError) { … }
TEST_F(AccessCodeCastHandlerTest, ProfileSyncPaused) { … }
TEST_F(AccessCodeCastHandlerTest, ProfileSyncSuccess) { … }
TEST_F(AccessCodeCastHandlerTest, SuccessfulAddAndCastMetric) { … }
}