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

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

Issue 2692903002: Don't show media controls when there is a persistent video. (Closed)
Patch Set: rebase 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 unified diff | Download patch
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/html/shadow/MediaControls.h" 5 #include "core/html/shadow/MediaControls.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/css/StylePropertySet.h" 8 #include "core/css/StylePropertySet.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 mediaControls().mediaElement().setBooleanAttribute( 287 mediaControls().mediaElement().setBooleanAttribute(
288 HTMLNames::disableremoteplaybackAttr, true); 288 HTMLNames::disableremoteplaybackAttr, true);
289 ASSERT_FALSE(isElementVisible(*castOverlayButton)); 289 ASSERT_FALSE(isElementVisible(*castOverlayButton));
290 290
291 mediaControls().mediaElement().setBooleanAttribute( 291 mediaControls().mediaElement().setBooleanAttribute(
292 HTMLNames::disableremoteplaybackAttr, false); 292 HTMLNames::disableremoteplaybackAttr, false);
293 ASSERT_TRUE(isElementVisible(*castOverlayButton)); 293 ASSERT_TRUE(isElementVisible(*castOverlayButton));
294 } 294 }
295 295
296 TEST_F(MediaControlsTest, CastOverlayMediaControlsDisabled) {
297 Element* castOverlayButton = getElementByShadowPseudoId(
298 mediaControls(), "-internal-media-controls-overlay-cast-button");
299 ASSERT_NE(nullptr, castOverlayButton);
300
301 EXPECT_FALSE(isElementVisible(*castOverlayButton));
302 simulateRouteAvailabe();
303 EXPECT_TRUE(isElementVisible(*castOverlayButton));
304
305 document().settings()->setMediaControlsEnabled(false);
306 EXPECT_FALSE(isElementVisible(*castOverlayButton));
307
308 document().settings()->setMediaControlsEnabled(true);
309 EXPECT_TRUE(isElementVisible(*castOverlayButton));
310 }
311
296 TEST_F(MediaControlsTest, KeepControlsVisibleIfOverflowListVisible) { 312 TEST_F(MediaControlsTest, KeepControlsVisibleIfOverflowListVisible) {
297 Element* overflowList = getElementByShadowPseudoId( 313 Element* overflowList = getElementByShadowPseudoId(
298 mediaControls(), "-internal-media-controls-overflow-menu-list"); 314 mediaControls(), "-internal-media-controls-overflow-menu-list");
299 ASSERT_NE(nullptr, overflowList); 315 ASSERT_NE(nullptr, overflowList);
300 316
301 Element* panel = getElementByShadowPseudoId(mediaControls(), 317 Element* panel = getElementByShadowPseudoId(mediaControls(),
302 "-webkit-media-controls-panel"); 318 "-webkit-media-controls-panel");
303 ASSERT_NE(nullptr, panel); 319 ASSERT_NE(nullptr, panel);
304 320
305 mediaControls().mediaElement().setSrc("http://example.com"); 321 mediaControls().mediaElement().setSrc("http://example.com");
306 mediaControls().mediaElement().play(); 322 mediaControls().mediaElement().play();
307 testing::runPendingTasks(); 323 testing::runPendingTasks();
308 324
309 mediaControls().show(); 325 mediaControls().show();
310 mediaControls().toggleOverflowMenu(); 326 mediaControls().toggleOverflowMenu();
311 EXPECT_TRUE(isElementVisible(*overflowList)); 327 EXPECT_TRUE(isElementVisible(*overflowList));
312 328
313 simulateHideMediaControlsTimerFired(); 329 simulateHideMediaControlsTimerFired();
314 EXPECT_TRUE(isElementVisible(*overflowList)); 330 EXPECT_TRUE(isElementVisible(*overflowList));
315 EXPECT_TRUE(isElementVisible(*panel)); 331 EXPECT_TRUE(isElementVisible(*panel));
316 } 332 }
317 333
318 } // namespace blink 334 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControls.cpp ('k') | third_party/WebKit/Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698