| 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 115567b7c682c3231d1b03a413184858f910608c..a96605af854d6438ea66134694c08532bfc493b9 100644
|
| --- a/third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp
|
| +++ b/third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp
|
| @@ -83,6 +83,7 @@ public:
|
| MOCK_CONST_METHOD0(muted, bool());
|
| MOCK_METHOD1(setMuted, void(bool));
|
| MOCK_METHOD0(playInternal, void());
|
| + MOCK_METHOD0(pauseInternal, void());
|
| MOCK_CONST_METHOD0(isLockedPendingUserGesture, bool());
|
| MOCK_METHOD0(unlockUserGesture, void());
|
| MOCK_METHOD1(recordAutoplayMetric, void(AutoplayMetrics));
|
| @@ -474,4 +475,32 @@ TEST_F(AutoplayExperimentTest, PlayTwiceIsIgnored)
|
| m_helper->playMethodCalled();
|
| }
|
|
|
| +TEST_F(AutoplayExperimentTest, CrossOriginMutedTests)
|
| +{
|
| + setInterface(new NiceMock<MockAutoplayClient>("enabled-forvideo-ifsameorigin-ormuted", MockAutoplayClient::Video));
|
| + ON_CALL(*m_client, isCrossOrigin()).WillByDefault(Return(true));
|
| +
|
| + // Cross-orgin unmuted content should be eligible.
|
| + setIsMuted(true);
|
| + EXPECT_TRUE(isEligible());
|
| +
|
| + // Cross-origin muted content should not be eligible.
|
| + setIsMuted(false);
|
| + EXPECT_FALSE(isEligible());
|
| +
|
| + // Start playback.
|
| + EXPECT_CALL(*m_client, recordAutoplayMetric(AutoplayMediaFound))
|
| + .Times(1);
|
| + m_helper->becameReadyToPlay();
|
| + ON_CALL(*m_client, paused()).WillByDefault(Return(false));
|
| + setIsMuted(true);
|
| + m_helper->mutedChanged();
|
| +
|
| + // Verify that unmuting pauses playback.
|
| + setIsMuted(false);
|
| + EXPECT_CALL(*m_client, pauseInternal())
|
| + .Times(1);
|
| + m_helper->mutedChanged();
|
| +}
|
| +
|
| }
|
|
|