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

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

Issue 2728193003: Show download button even when preload=none (Closed)
Patch Set: Fix incorrect download button unit test and rebase 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 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 <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 #include "core/HTMLNames.h" 9 #include "core/HTMLNames.h"
10 #include "core/css/StylePropertySet.h" 10 #include "core/css/StylePropertySet.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 mediaControls().mediaElement().setSrc("https://example.com/foo.mp4"); 393 mediaControls().mediaElement().setSrc("https://example.com/foo.mp4");
394 testing::runPendingTasks(); 394 testing::runPendingTasks();
395 simulateLoadedMetadata(); 395 simulateLoadedMetadata();
396 EXPECT_TRUE(isElementVisible(*downloadButton)); 396 EXPECT_TRUE(isElementVisible(*downloadButton));
397 histogramTester().expectBucketCount("Media.Controls.Download", 397 histogramTester().expectBucketCount("Media.Controls.Download",
398 DownloadActionMetrics::Shown, 1); 398 DownloadActionMetrics::Shown, 1);
399 399
400 // Hide button. 400 // Hide button.
401 mediaControls().mediaElement().setSrc(""); 401 mediaControls().mediaElement().setSrc("");
402 testing::runPendingTasks(); 402 testing::runPendingTasks();
403 EXPECT_TRUE(isElementVisible(*downloadButton)); 403 EXPECT_FALSE(isElementVisible(*downloadButton));
404 histogramTester().expectBucketCount("Media.Controls.Download", 404 histogramTester().expectBucketCount("Media.Controls.Download",
405 DownloadActionMetrics::Shown, 1); 405 DownloadActionMetrics::Shown, 1);
whywhat 2017/03/07 12:50:56 Strange you don't need to update that. Shouldn't t
steimel 2017/03/07 15:26:21 Hmm I'm not actually sure what that's measuring ex
406 406
407 // Showing button again should not increment Shown count. 407 // Showing button again should not increment Shown count.
408 mediaControls().mediaElement().setSrc("https://example.com/foo.mp4"); 408 mediaControls().mediaElement().setSrc("https://example.com/foo.mp4");
409 testing::runPendingTasks(); 409 testing::runPendingTasks();
410 EXPECT_TRUE(isElementVisible(*downloadButton)); 410 EXPECT_TRUE(isElementVisible(*downloadButton));
411 histogramTester().expectBucketCount("Media.Controls.Download", 411 histogramTester().expectBucketCount("Media.Controls.Download",
412 DownloadActionMetrics::Shown, 1); 412 DownloadActionMetrics::Shown, 1);
413 } 413 }
414 414
415 TEST_F(MediaControlsTest, DownloadButtonRecordsClickOnlyOnce) { 415 TEST_F(MediaControlsTest, DownloadButtonRecordsClickOnlyOnce) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 // underlying <input type="range">. This would set the |value| to the |max| 500 // underlying <input type="range">. This would set the |value| to the |max|
501 // attribute, which can be slightly rounded relative to the duration. 501 // attribute, which can be slightly rounded relative to the duration.
502 timeline->setValueAsNumber(roundedUpDuration, ASSERT_NO_EXCEPTION); 502 timeline->setValueAsNumber(roundedUpDuration, ASSERT_NO_EXCEPTION);
503 ASSERT_EQ(roundedUpDuration, timeline->valueAsNumber()); 503 ASSERT_EQ(roundedUpDuration, timeline->valueAsNumber());
504 EXPECT_EQ(0.0, mediaControls().mediaElement().currentTime()); 504 EXPECT_EQ(0.0, mediaControls().mediaElement().currentTime());
505 timeline->dispatchInputEvent(); 505 timeline->dispatchInputEvent();
506 EXPECT_EQ(exactDuration, mediaControls().mediaElement().currentTime()); 506 EXPECT_EQ(exactDuration, mediaControls().mediaElement().currentTime());
507 } 507 }
508 508
509 } // namespace blink 509 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698