chromium/content/browser/media/session/media_session_service_impl_browsertest.cc

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

#include "content/browser/media/session/media_session_service_impl.h"

#include <memory>

#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "content/browser/media/session/media_session_impl.h"
#include "content/browser/media/session/media_session_player_observer.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "media/base/media_content_type.h"
#include "services/media_session/public/cpp/test/mock_media_session.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace content {

namespace {

class NavigationWatchingWebContentsObserver : public WebContentsObserver {};

class MockMediaSessionPlayerObserver : public MediaSessionPlayerObserver {};

void NavigateToURLAndWaitForFinish(Shell* window, const GURL& url) {}

char kSetUpMediaSessionScript[] =;

char kSetUpWebRTCMediaSessionScript[] =;

const int kPlayerId =;

}  // anonymous namespace

class MediaSessionServiceImplBrowserTest : public ContentBrowserTest {};

// Two windows from the same BrowserContext.
IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest,
                       CrashMessageOnUnload) {}

// Tests for checking if the media session service members are correctly reset
// when navigating. Due to the mojo services have different message queues, it's
// hard to wait for the messages to arrive. Temporarily, the tests are using
// observers to wait for the message to be processed on the MediaSessionObserver
// side.

#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
    BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
// crbug.com/927234.
#define MAYBE_ResetServiceWhenNavigatingAway
#else
#define MAYBE_ResetServiceWhenNavigatingAway
#endif
IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest,
                       MAYBE_ResetServiceWhenNavigatingAway) {}

// crbug.com/927234.
IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest,
                       DISABLED_DontResetServiceForSameDocumentNavigation) {}

IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest,
                       MicrophoneAndCameraStatesInitiallyUnknown) {}

IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest,
                       MicrophoneAndCameraStatesCanBeSet) {}

}  // namespace content