chromium/chrome/browser/extensions/api/offscreen/audio_lifetime_enforcer_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 "extensions/browser/api/offscreen/audio_lifetime_enforcer.h"

#include <optional>

#include "base/run_loop.h"
#include "base/test/bind.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "components/version_info/channel.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/offscreen_document_host.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/extension.h"
#include "extensions/test/test_extension_dir.h"

namespace extensions {

namespace {

// A helper class to wait until a given WebContents is audible or inaudible.
class AudioWaiter : public content::WebContentsObserver {};

}  // namespace

class AudioLifetimeEnforcerBrowserTest : public ExtensionApiTest {};

// Tests that an offscreen document is considered active while playing audio and
// notifies of inactivity when audio stops.
IN_PROC_BROWSER_TEST_F(AudioLifetimeEnforcerBrowserTest,
                       DocumentActiveWhilePlayingAudio) {}

// Tests that an offscreen document is considered inactive if it never plays
// audio.
IN_PROC_BROWSER_TEST_F(AudioLifetimeEnforcerBrowserTest,
                       DocumentInactiveIfNeverPlayedAudio) {}

}  // namespace extensions