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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp

Issue 2725893002: Media Controls timeline: immediately update current time display (Closed)
Patch Set: Created 3 years, 10 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/shadow/MediaControlElements.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/shadow/MediaControlsTest.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
index 4382731a04b497a200cbc9f1f4505674a7107c99..7d66030f0ab6a734e293c66d95bc50f11daae792 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -182,6 +182,17 @@ class MediaControlsTest : public ::testing::Test {
}
Document& document() { return m_pageHolder->document(); }
+ void loadMediaWithDuration(double duration) {
+ mediaControls().mediaElement().setSrc("https://example.com/foo.mp4");
+ testing::runPendingTasks();
+
+ WebTimeRange timeRange(0.0, duration);
+ webMediaPlayer()->m_seekable.assign(&timeRange, 1);
+ mediaControls().mediaElement().durationChanged(duration,
+ false /* requestSeek */);
+ simulateLoadedMetadata();
+ }
+
private:
std::unique_ptr<DummyPageHolder> m_pageHolder;
Persistent<MediaControls> m_mediaControls;
@@ -410,20 +421,12 @@ TEST_F(MediaControlsTest, TimelineSeekToRoundedEnd) {
mediaControls(), "-webkit-media-controls-timeline"));
ASSERT_NE(nullptr, timeline);
- mediaControls().mediaElement().setSrc("https://example.com/foo.mp4");
- testing::runPendingTasks();
-
// Tests the case where the real length of the video, |exactDuration|, gets
// rounded up slightly to |roundedUpDuration| when setting the timeline's
// |max| attribute (crbug.com/695065).
double exactDuration = 596.586667;
double roundedUpDuration = 596.587;
-
- WebTimeRange timeRange(0.0, exactDuration);
- webMediaPlayer()->m_seekable.assign(&timeRange, 1);
- mediaControls().mediaElement().durationChanged(exactDuration,
- false /* requestSeek */);
- simulateLoadedMetadata();
+ loadMediaWithDuration(exactDuration);
// Simulate a click slightly past the end of the track of the timeline's
// underlying <input type="range">. This would set the |value| to the |max|
@@ -435,4 +438,27 @@ TEST_F(MediaControlsTest, TimelineSeekToRoundedEnd) {
EXPECT_EQ(exactDuration, mediaControls().mediaElement().currentTime());
}
+TEST_F(MediaControlsTest, TimelineImmediatelyUpdatesCurrentTime) {
+ ensureLayout();
+
+ MediaControlTimelineElement* timeline =
+ static_cast<MediaControlTimelineElement*>(getElementByShadowPseudoId(
+ mediaControls(), "-webkit-media-controls-timeline"));
+ ASSERT_NE(nullptr, timeline);
+ MediaControlCurrentTimeDisplayElement* currentTimeDisplay =
+ static_cast<MediaControlCurrentTimeDisplayElement*>(
+ getElementByShadowPseudoId(
+ mediaControls(), "-webkit-media-controls-current-time-display"));
+ ASSERT_NE(nullptr, currentTimeDisplay);
+
+ double duration = 600;
+ loadMediaWithDuration(duration);
+
+ // Simulate seeking the underlying range to 50%. Current time display should
+ // update synchronously (crbug.com/695459).
mlamouri (slow - plz ping) 2017/03/02 10:37:19 No need to link to the bug, if someone needs to ha
johnme 2017/03/02 13:31:30 Done (though the bug provides useful clarification
+ timeline->setValueAsNumber(duration / 2, ASSERT_NO_EXCEPTION);
+ timeline->dispatchInputEvent();
+ EXPECT_EQ(duration / 2, currentTimeDisplay->currentValue());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698