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

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

Issue 2701433003: Hide overlay play button if it can't be shown without clipping (Closed)
Patch Set: Fix compile warning for uninitialized variable Created 3 years, 9 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
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 19caa77d06e23f5d97f51275f8c21f9d241465f0..2c512ce0e0c918e2cef1beded03e697dbcfd1fdc 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -171,10 +171,11 @@ class MediaControlsTest : public ::testing::Test {
WebRemotePlaybackAvailability::DeviceAvailable);
}
- void ensureLayout() {
- // Force a relayout, so that the controls know the width. Otherwise,
- // they don't know if, for example, the cast button will fit.
- m_mediaControls->mediaElement().clientWidth();
+ void ensureSizing() {
+ // Fire the size-change callback to ensure that the controls have
+ // been properly notified of the video size.
+ m_mediaControls->notifyElementSizeChanged(
+ m_mediaControls->mediaElement().getBoundingClientRect());
}
void simulateHideMediaControlsTimerFired() {
@@ -252,7 +253,7 @@ TEST_F(MediaControlsTest, ResetDoesNotTriggerInitialLayout) {
}
TEST_F(MediaControlsTest, CastButtonRequiresRoute) {
- ensureLayout();
+ ensureSizing();
mediaControls().mediaElement().setBooleanAttribute(HTMLNames::controlsAttr,
true);
@@ -267,7 +268,7 @@ TEST_F(MediaControlsTest, CastButtonRequiresRoute) {
}
TEST_F(MediaControlsTest, CastButtonDisableRemotePlaybackAttr) {
- ensureLayout();
+ ensureSizing();
mediaControls().mediaElement().setBooleanAttribute(HTMLNames::controlsAttr,
true);
@@ -354,7 +355,7 @@ TEST_F(MediaControlsTest, KeepControlsVisibleIfOverflowListVisible) {
}
TEST_F(MediaControlsTest, DownloadButtonDisplayed) {
- ensureLayout();
+ ensureSizing();
Element* downloadButton = getElementByShadowPseudoId(
mediaControls(), "-internal-media-controls-download-button");
@@ -369,7 +370,7 @@ TEST_F(MediaControlsTest, DownloadButtonDisplayed) {
}
TEST_F(MediaControlsTest, DownloadButtonNotDisplayedEmptyUrl) {
- ensureLayout();
+ ensureSizing();
Element* downloadButton = getElementByShadowPseudoId(
mediaControls(), "-internal-media-controls-download-button");
@@ -383,7 +384,7 @@ TEST_F(MediaControlsTest, DownloadButtonNotDisplayedEmptyUrl) {
}
TEST_F(MediaControlsTest, DownloadButtonDisplayedHiddenAndDisplayed) {
- ensureLayout();
+ ensureSizing();
Element* downloadButton = getElementByShadowPseudoId(
mediaControls(), "-internal-media-controls-download-button");
@@ -413,7 +414,7 @@ TEST_F(MediaControlsTest, DownloadButtonDisplayedHiddenAndDisplayed) {
}
TEST_F(MediaControlsTest, DownloadButtonRecordsClickOnlyOnce) {
- ensureLayout();
+ ensureSizing();
MediaControlDownloadButtonElement* downloadButton =
static_cast<MediaControlDownloadButtonElement*>(
@@ -443,7 +444,7 @@ TEST_F(MediaControlsTest, DownloadButtonRecordsClickOnlyOnce) {
}
TEST_F(MediaControlsTest, DownloadButtonNotDisplayedInfiniteDuration) {
- ensureLayout();
+ ensureSizing();
Element* downloadButton = getElementByShadowPseudoId(
mediaControls(), "-internal-media-controls-download-button");
@@ -460,7 +461,7 @@ TEST_F(MediaControlsTest, DownloadButtonNotDisplayedInfiniteDuration) {
}
TEST_F(MediaControlsTest, DownloadButtonNotDisplayedHLS) {
- ensureLayout();
+ ensureSizing();
Element* downloadButton = getElementByShadowPseudoId(
mediaControls(), "-internal-media-controls-download-button");
@@ -474,7 +475,7 @@ TEST_F(MediaControlsTest, DownloadButtonNotDisplayedHLS) {
}
TEST_F(MediaControlsTest, TimelineSeekToRoundedEnd) {
- ensureLayout();
+ ensureSizing();
MediaControlTimelineElement* timeline =
static_cast<MediaControlTimelineElement*>(getElementByShadowPseudoId(

Powered by Google App Engine
This is Rietveld 408576698