chromium/chrome/browser/policy/test/autoplay_policy_browsertest.cc

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

#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/policy/policy_test_utils.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/policy_constants.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"

namespace policy {

namespace {
const char kAutoplayTestPageURL[] =;
const char kUnifiedAutoplayTestPageURL[] =;
}  // namespace

class AutoplayPolicyTest : public PolicyTest {};

IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayAllowedByPolicy) {}

IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, CrossOriginIframe) {}

// Flaky on Linux. See: crbug.com/1189597.
#if BUILDFLAG(IS_LINUX)
#define MAYBE_AutoplayAllowlist_Allowed
#else
#define MAYBE_AutoplayAllowlist_Allowed
#endif
IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, MAYBE_AutoplayAllowlist_Allowed) {}

IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayAllowlist_PatternAllowed) {}

IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayAllowlist_Missing) {}

// Flaky on Linux and ChromeOS. See: crbug.com/1172978.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_AutoplayDeniedByPolicy
#else
#define MAYBE_AutoplayDeniedByPolicy
#endif
IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, MAYBE_AutoplayDeniedByPolicy) {}

// Flaky on Linux. See: crbug.com/1172978.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_AutoplayDeniedAllowedWithURL
#else
#define MAYBE_AutoplayDeniedAllowedWithURL
#endif
IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, MAYBE_AutoplayDeniedAllowedWithURL) {}

// TODO(crbug.com/40742600): Flaky test.
IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest,
                       DISABLED_AutoplayAllowedGlobalAndURL) {}

class AutoplayPolicyFencedFrameTest : public AutoplayPolicyTest {};

IN_PROC_BROWSER_TEST_F(AutoplayPolicyFencedFrameTest, AutoplayAllowedByPolicy) {}

IN_PROC_BROWSER_TEST_F(AutoplayPolicyFencedFrameTest,
                       AutoplayAllowlist_Allowed) {}

}  // namespace policy