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

Unified Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp

Issue 2909093002: Add MediaControlsImplTestWithMockScheduler. (Closed)
Patch Set: CR Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
index 2c0729d20329dd4e57d0089e1c257bf9e5e66fee..f194dc69e1a2e52f9c9ba0efe042a83d1a333531 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
@@ -791,15 +791,25 @@ TEST_F(MediaControlsImplTest, MAYBE_TimelineMetricsDragBackAndForth) {
"Media.Timeline.DragTimeDelta.128_255", 9 /* (-4m, -2m] */, 1);
}
-TEST_F(MediaControlsImplTest, ControlsRemainVisibleDuringKeyboardInteraction) {
+namespace {
+
+class MediaControlsImplTestWithMockScheduler : public MediaControlsImplTest {
+ protected:
+ void SetUp() override {
+ // DocumentParserTiming has DCHECKS to make sure time > 0.0.
+ platform_->AdvanceClockSeconds(1);
+
+ MediaControlsImplTest::SetUp();
+ }
+
ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
- platform;
+ platform_;
+};
- // DocumentParserTiming has DCHECKS to make sure time > 0.0.
- platform->AdvanceClockSeconds(1);
+} // namespace
- // Need to reinitialize page since we changed the platform.
- InitializePage();
+TEST_F(MediaControlsImplTestWithMockScheduler,
+ ControlsRemainVisibleDuringKeyboardInteraction) {
EnsureSizing();
Element* panel = MediaControls().PanelElement();
@@ -813,23 +823,23 @@ TEST_F(MediaControlsImplTest, ControlsRemainVisibleDuringKeyboardInteraction) {
EXPECT_TRUE(IsElementVisible(*panel));
// Tabbing between controls prevents controls from hiding.
- platform->RunForPeriodSeconds(2);
+ platform_->RunForPeriodSeconds(2);
MediaControls().DispatchEvent(Event::Create("focusin"));
- platform->RunForPeriodSeconds(2);
+ platform_->RunForPeriodSeconds(2);
EXPECT_TRUE(IsElementVisible(*panel));
// Seeking on the timeline or volume bar prevents controls from hiding.
MediaControls().DispatchEvent(Event::Create("input"));
- platform->RunForPeriodSeconds(2);
+ platform_->RunForPeriodSeconds(2);
EXPECT_TRUE(IsElementVisible(*panel));
// Pressing a key prevents controls from hiding.
MediaControls().PanelElement()->DispatchEvent(Event::Create("keypress"));
- platform->RunForPeriodSeconds(2);
+ platform_->RunForPeriodSeconds(2);
EXPECT_TRUE(IsElementVisible(*panel));
// Once user interaction stops, controls can hide.
- platform->RunForPeriodSeconds(2);
+ platform_->RunForPeriodSeconds(2);
EXPECT_FALSE(IsElementVisible(*panel));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698