Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp

Issue 1931363002: Autoplay experiment: ignore viewport visibility requirements for audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay-htmlmedialement
Patch Set: update tests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp
diff --git a/third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp b/third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp
index 9a8705a5a7f76fcce4738e044c9756bd830af50d..ed0bdaadd7a395a88f3b07e930732cf0a822788d 100644
--- a/third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp
+++ b/third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp
@@ -110,6 +110,11 @@ public:
return m_helper->isEligible();
}
+ bool meetsVisibilityRequirements()
+ {
+ return m_helper->meetsVisibilityRequirements();
+ }
+
void setInterface(MockAutoplayClient* client)
{
m_client = client;
@@ -456,4 +461,16 @@ TEST_F(AutoplayExperimentTest, WithoutSameOriginTests)
EXPECT_TRUE(isEligible());
}
+TEST_F(AutoplayExperimentTest, AudioPageVisibility)
+{
+ setInterface(new NiceMock<MockAutoplayClient>("enabled-foraudio-ifpagevisible", MockAutoplayClient::Audio));
+ ON_CALL(*m_client, pageVisibilityState()).WillByDefault(Return(PageVisibilityStateVisible));
+ EXPECT_TRUE(isEligible());
+ EXPECT_TRUE(meetsVisibilityRequirements());
+
+ ON_CALL(*m_client, pageVisibilityState()).WillByDefault(Return(PageVisibilityStateHidden));
+ EXPECT_TRUE(isEligible());
+ EXPECT_FALSE(meetsVisibilityRequirements());
+}
+
}
« no previous file with comments | « third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698