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

Side by Side Diff: third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)
Patch Set: Callback cleanup, comments Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698