#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/chrome_content_settings_utils.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/media/media_engagement_preloaded_list.h"
#include "chrome/browser/media/media_engagement_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "media/base/media_switches.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
namespace {
base::FilePath GetPythonPath() { … }
const base::FilePath kTestDataPath = …;
const char kMediaEngagementTestDataPath[] = …;
const std::u16string kAllowedTitle = …;
const std::u16string kDeniedTitle = …;
const base::FilePath kEmptyDataPath = …;
const std::vector<base::test::FeatureRef> kFeatures = …;
}
class MediaEngagementAutoplayBrowserTest
: public testing::WithParamInterface<bool>,
public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
BypassAutoplayHighEngagement) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
DoNotBypassAutoplayLowEngagement) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
DoNotBypassAutoplayNoEngagement) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
DoNotBypassAutoplayFrameHighEngagement_NoDelegation) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
DoNotBypassAutoplayFrameLowEngagement_NoDelegation) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
BypassAutoplayFrameHighEngagement_Delegation) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
DoNotBypassAutoplayFrameLowEngagement_Delegation) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
DoNotBypassAutoplayFrameNoEngagement) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
ClearEngagementOnNavigation) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
HasHighScoreThreshold) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_UsePreloadedData_Allowed …
#else
#define MAYBE_UsePreloadedData_Allowed …
#endif
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
MAYBE_UsePreloadedData_Allowed) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
UsePreloadedData_Denied) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest,
PreloadedDataAndHighVisits) { … }
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTest, TopFrameNavigation) { … }
class MediaEngagementAutoplayBrowserTestHttpsOnly
: public MediaEngagementAutoplayBrowserTest { … };
IN_PROC_BROWSER_TEST_P(MediaEngagementAutoplayBrowserTestHttpsOnly,
BypassAutoplayHighEngagement) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);