chromium/components/media_router/browser/media_router_dialog_controller_unittest.cc

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

#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)
// The non-Android implementation is tested in
// MediaRouterDialogControllerViewsTest.
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);
  // Returns the same value the second time.
  ASSERT_EQ(
      dialog_controller,
      MediaRouterDialogController::GetOrCreateForWebContents(web_contents()));
}
#endif

TEST_F(MediaRouterDialogControllerTest, ShowAndHideDialog) {}

TEST_F(MediaRouterDialogControllerTest, ShowDialogForPresentation) {}

TEST_F(MediaRouterDialogControllerTest, StartPresentationContext) {}

}  // namespace media_router