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

Unified Diff: media/base/download_rate_monitor_unittest.cc

Issue 9113023: Fire canplaythrough as soon as download defers to fix autoplay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 12 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: media/base/download_rate_monitor_unittest.cc
diff --git a/media/base/download_rate_monitor_unittest.cc b/media/base/download_rate_monitor_unittest.cc
index 321ad630e51c0011a8551386120f22f1846bb851..d71e93fb83cb9db7bb729018fe026beb72da4742 100644
--- a/media/base/download_rate_monitor_unittest.cc
+++ b/media/base/download_rate_monitor_unittest.cc
@@ -47,7 +47,6 @@ class DownloadRateMonitorTest : public ::testing::Test {
packet_time += base::TimeDelta::FromMilliseconds(ms_between_packets);
bytes_buffered += bytes_per_packet;
}
- monitor_.SetNetworkActivity(false);
return bytes_buffered;
}
@@ -75,19 +74,18 @@ TEST_F(DownloadRateMonitorTest, DownloadRateGreaterThanBitrate) {
SimulateNetwork(1, 0, 2 * media_bitrate / 8, 1000, 10);
}
-// If the user pauses and the pipeline stops downloading data, make sure the
-// DownloadRateMonitor understands that the download is not stalling.
-TEST_F(DownloadRateMonitorTest, DownloadRateGreaterThanBitrate_Pause) {
acolwell GONE FROM CHROMIUM 2012/01/05 22:33:56 Based on what the comment sayd, I think this test
vrk (LEFT CHROMIUM) 2012/01/09 19:01:18 Ahhh, now I remember why I deleted this. The test
+TEST_F(DownloadRateMonitorTest, DownloadRateGreaterThanBitrate_Defer) {
static const int media_bitrate = 1024 * 1024 * 8;
static const int download_byte_rate = 1.1 * media_bitrate / 8;
// Start downloading faster than the media's bitrate.
StartMonitor(media_bitrate);
- EXPECT_CALL(*this, CanPlayThrough());
- int buffered = SimulateNetwork(1, 0, download_byte_rate, 1000, 2);
+ SimulateNetwork(1, 0, download_byte_rate, 1000, 2);
- // Then "pause" for 3 minutes and continue downloading at same rate.
- SimulateNetwork(60 * 3, buffered, download_byte_rate, 1000, 4);
+ // Now defer download because the client has decided enough data has been
+ // buffered.
+ EXPECT_CALL(*this, CanPlayThrough());
+ monitor_.SetNetworkActivity(false);
}
TEST_F(DownloadRateMonitorTest, DownloadRateGreaterThanBitrate_SeekForward) {

Powered by Google App Engine
This is Rietveld 408576698