chromium/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.h"

#include "base/auto_reset.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/gtest_tags.h"
#include "base/test/mock_callback.h"
#include "base/test/test_future.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_constants.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_test_util.h"
#include "chrome/browser/media/router/discovery/media_sink_discovery_metrics.h"
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/media_router/common/test/test_helper.h"
#include "components/performance_manager/public/features.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_host_resolver.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
#include "ui/events/keycodes/keyboard_codes.h"

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "base/barrier_closure.h"
#include "base/json/values_util.h"
#include "base/test/test_future.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_pref_updater_lacros.h"
#include "chromeos/crosapi/mojom/prefs.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#else
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_pref_updater_impl.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/ash/cast_config/cast_config_controller_media_router.h"
#endif

_;
namespace {
class TestMediaRouter : public media_router::MockMediaRouter {};

class CloseObserver : public content::WebContentsObserver {};

std::unique_ptr<KeyedService> CreateTestSyncService(content::BrowserContext*) {}

}  // namespace

namespace media_router {

AccessCodeCastIntegrationBrowserTest::AccessCodeCastIntegrationBrowserTest()
    :{}

AccessCodeCastIntegrationBrowserTest::~AccessCodeCastIntegrationBrowserTest() =
    default;

void AccessCodeCastIntegrationBrowserTest::SetUp() {}

void AccessCodeCastIntegrationBrowserTest::SetUpInProcessBrowserTestFixture() {}

void AccessCodeCastIntegrationBrowserTest::OnWillCreateBrowserContextServices(
    content::BrowserContext* context) {}

void AccessCodeCastIntegrationBrowserTest::SetUpOnMainThread() {}

void AccessCodeCastIntegrationBrowserTest::SetUpPrimaryAccountWithHostedDomain(
    signin::ConsentLevel consent_level,
    Profile* profile,
    bool sign_in_account) {}

void AccessCodeCastIntegrationBrowserTest::EnableAccessCodeCasting() {}

void AccessCodeCastIntegrationBrowserTest::ShowUi(const std::string& name) {}

content::WebContents* AccessCodeCastIntegrationBrowserTest::ShowDialog() {}

void AccessCodeCastIntegrationBrowserTest::CloseDialog(
    content::WebContents* dialog_contents) {}

void AccessCodeCastIntegrationBrowserTest::SetAccessCode(
    std::string access_code,
    content::WebContents* dialog_contents) {}

void AccessCodeCastIntegrationBrowserTest::PressSubmit(
    content::WebContents* dialog_contents) {}

void AccessCodeCastIntegrationBrowserTest::PressSubmitAndWaitForClose(
    content::WebContents* dialog_contents) {}

void AccessCodeCastIntegrationBrowserTest::CloseDialogUsingKeyPress() {}

void AccessCodeCastIntegrationBrowserTest::SetAccessCodeUsingKeyPress(
    const std::string& access_code) {}

void AccessCodeCastIntegrationBrowserTest::PressSubmitUsingKeyPress() {}

void AccessCodeCastIntegrationBrowserTest::
    PressSubmitAndWaitForCloseUsingKeyPress(
        content::WebContents* dialog_contents) {}

int AccessCodeCastIntegrationBrowserTest::WaitForAddSinkErrorCode(
    content::WebContents* dialog_contents) {}

bool AccessCodeCastIntegrationBrowserTest::HasSinkInDevicesDict(
    const MediaSink::Id& sink_id) {}

std::optional<base::Time>
AccessCodeCastIntegrationBrowserTest::GetDeviceAddedTimeFromDict(
    const MediaSink::Id& sink_id) {}

void AccessCodeCastIntegrationBrowserTest::TearDownOnMainThread() {}

void AccessCodeCastIntegrationBrowserTest::ExpectMediaRouterHasNoSinks(
    base::OnceClosure callback,
    bool has_sink) {}

void AccessCodeCastIntegrationBrowserTest::ExpectMediaRouterHasSink(
    base::OnceClosure callback,
    bool has_sink) {}

std::unique_ptr<KeyedService>
AccessCodeCastIntegrationBrowserTest::CreateAccessCodeCastSinkService(
    content::BrowserContext* context) {}

MockCastMediaSinkServiceImpl*
AccessCodeCastIntegrationBrowserTest::CreateImpl() {}

void AccessCodeCastIntegrationBrowserTest::MockOnChannelOpenedCall(
    const MediaSinkInternal& cast_sink,
    std::unique_ptr<net::BackoffEntry> backoff_entry,
    CastDeviceCountMetrics::SinkSource sink_source,
    ChannelOpenedCallback callback,
    cast_channel::CastSocketOpenParams open_params) {}

void AccessCodeCastIntegrationBrowserTest::SpinRunLoop(base::TimeDelta delay) {}

content::EvalJsResult AccessCodeCastIntegrationBrowserTest::EvalJs(
    const std::string& string_value,
    content::WebContents* web_contents) {}

void AccessCodeCastIntegrationBrowserTest::SetEndpointFetcherMockResponse(
    const std::string& response_data,
    net::HttpStatusCode response_code,
    net::Error error) {}

// URLLoaderInterceptor callback
bool AccessCodeCastIntegrationBrowserTest::InterceptRequest(
    content::URLLoaderInterceptor::RequestParams* params) {}

void AccessCodeCastIntegrationBrowserTest::SetMockOpenChannelCallbackResponse(
    bool channel_opened) {}

void AccessCodeCastIntegrationBrowserTest::UpdateSinks(
    const std::vector<MediaSink>& sinks,
    const std::vector<url::Origin>& origins) {}

void AccessCodeCastIntegrationBrowserTest::UpdateRoutes(
    const std::vector<MediaRoute>& routes) {}

void AccessCodeCastIntegrationBrowserTest::ExpectStartRouteCallFromTabMirroring(
    const std::string& sink_name,
    const std::string& media_source_id,
    content::WebContents* web_contents,
    base::TimeDelta timeout,
    media_router::MockMediaRouter* media_router) {}

AccessCodeCastPrefUpdater*
AccessCodeCastIntegrationBrowserTest::GetPrefUpdater() {}

void AccessCodeCastIntegrationBrowserTest::AddScreenplayTag(
    const std::string& screenplay_tag) {}

void AccessCodeCastIntegrationBrowserTest::UpdateDeviceAddedTime(
    const MediaSink::Id& sink_id) {}

void AccessCodeCastIntegrationBrowserTest::
    SetAccessCodeCastSinkServiceTaskRunner() {}

bool AccessCodeCastIntegrationBrowserTest::IsAccessCodeCastLacrosSyncEnabled() {}

}  // namespace media_router