| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "core/html/AutoplayExperimentHelper.h" | 6 #include "core/html/AutoplayExperimentHelper.h" |
| 7 #include "platform/UserGestureIndicator.h" | 7 #include "platform/UserGestureIndicator.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 EXPECT_CALL(*m_client, recordAutoplayMetric(AnyPlaybackStarted)).Times(1); | 127 EXPECT_CALL(*m_client, recordAutoplayMetric(AnyPlaybackStarted)).Times(1); |
| 128 m_helper->playbackStarted(); | 128 m_helper->playbackStarted(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void startPlaybackWithoutUserGesture() { | 131 void startPlaybackWithoutUserGesture() { |
| 132 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 132 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 133 startPlayback(); | 133 startPlayback(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void startPlaybackWithUserGesture() { | 136 void startPlaybackWithUserGesture() { |
| 137 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); | 137 UserGestureIndicator indicator(UserGestureToken::create()); |
| 138 EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); | 138 EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); |
| 139 startPlayback(); | 139 startPlayback(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void setUserGestureRequiredForPlay(bool required) { | 142 void setUserGestureRequiredForPlay(bool required) { |
| 143 ON_CALL(*m_client, isLockedPendingUserGesture()) | 143 ON_CALL(*m_client, isLockedPendingUserGesture()) |
| 144 .WillByDefault(Return(required)); | 144 .WillByDefault(Return(required)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void setShouldAutoplay(bool should) { | 147 void setShouldAutoplay(bool should) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 ON_CALL(*m_client, paused()).WillByDefault(Return(false)); | 444 ON_CALL(*m_client, paused()).WillByDefault(Return(false)); |
| 445 setIsMuted(true); | 445 setIsMuted(true); |
| 446 m_helper->mutedChanged(); | 446 m_helper->mutedChanged(); |
| 447 | 447 |
| 448 // Verify that unmuting pauses playback. | 448 // Verify that unmuting pauses playback. |
| 449 setIsMuted(false); | 449 setIsMuted(false); |
| 450 EXPECT_CALL(*m_client, pauseInternal()).Times(1); | 450 EXPECT_CALL(*m_client, pauseInternal()).Times(1); |
| 451 m_helper->mutedChanged(); | 451 m_helper->mutedChanged(); |
| 452 } | 452 } |
| 453 } | 453 } |
| OLD | NEW |