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

Side by Side Diff: media/blink/watch_time_reporter_unittest.cc

Issue 2822543006: Start reporting watch time if ABR adapts above 200p. (Closed)
Patch Set: Simplify Created 3 years, 8 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
« no previous file with comments | « media/blink/watch_time_reporter.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_message_loop.h" 10 #include "base/test/test_message_loop.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 }; 272 };
273 273
274 // Tests that watch time reporting is appropriately enabled or disabled. 274 // Tests that watch time reporting is appropriately enabled or disabled.
275 TEST_P(WatchTimeReporterTest, WatchTimeReporter) { 275 TEST_P(WatchTimeReporterTest, WatchTimeReporter) {
276 EXPECT_CALL(*this, GetCurrentMediaTime()) 276 EXPECT_CALL(*this, GetCurrentMediaTime())
277 .WillRepeatedly(testing::Return(base::TimeDelta())); 277 .WillRepeatedly(testing::Return(base::TimeDelta()));
278 278
279 Initialize(!has_video_, true, true, gfx::Size()); 279 Initialize(!has_video_, true, true, gfx::Size());
280 wtr_->OnPlaying(); 280 wtr_->OnPlaying();
281 EXPECT_EQ(!has_video_, IsMonitoring()); 281 EXPECT_EQ(!has_video_, IsMonitoring());
282 EXPECT_FALSE(wtr_->IsSizeLargeEnoughToReportWatchTime());
282 283
283 Initialize(true, true, true, gfx::Size()); 284 Initialize(true, true, true, gfx::Size());
284 wtr_->OnPlaying(); 285 wtr_->OnPlaying();
285 EXPECT_EQ(!has_video_, IsMonitoring()); 286 EXPECT_EQ(!has_video_, IsMonitoring());
287 EXPECT_FALSE(wtr_->IsSizeLargeEnoughToReportWatchTime());
286 288
287 constexpr gfx::Size kSizeTooSmall = gfx::Size(100, 100); 289 constexpr gfx::Size kSizeTooSmall = gfx::Size(100, 100);
288 Initialize(!has_video_, true, true, kSizeTooSmall); 290 Initialize(!has_video_, true, true, kSizeTooSmall);
289 wtr_->OnPlaying(); 291 wtr_->OnPlaying();
290 EXPECT_EQ(!has_video_, IsMonitoring()); 292 EXPECT_EQ(!has_video_, IsMonitoring());
293 EXPECT_FALSE(wtr_->IsSizeLargeEnoughToReportWatchTime());
291 294
292 Initialize(true, true, true, kSizeJustRight); 295 Initialize(true, true, true, kSizeJustRight);
293 wtr_->OnPlaying(); 296 wtr_->OnPlaying();
294 EXPECT_TRUE(IsMonitoring()); 297 EXPECT_TRUE(IsMonitoring());
298 EXPECT_TRUE(wtr_->IsSizeLargeEnoughToReportWatchTime());
295 299
296 Initialize(true, false, false, kSizeJustRight); 300 Initialize(true, false, false, kSizeJustRight);
297 wtr_->OnPlaying(); 301 wtr_->OnPlaying();
298 EXPECT_TRUE(IsMonitoring()); 302 EXPECT_TRUE(IsMonitoring());
303 EXPECT_TRUE(wtr_->IsSizeLargeEnoughToReportWatchTime());
299 304
300 Initialize(true, true, false, kSizeJustRight); 305 Initialize(true, true, false, kSizeJustRight);
301 wtr_->OnPlaying(); 306 wtr_->OnPlaying();
302 EXPECT_TRUE(IsMonitoring()); 307 EXPECT_TRUE(IsMonitoring());
308 EXPECT_TRUE(wtr_->IsSizeLargeEnoughToReportWatchTime());
303 309
304 Initialize(true, true, true, gfx::Size()); 310 Initialize(true, true, true, gfx::Size());
305 wtr_->OnPlaying(); 311 wtr_->OnPlaying();
306 EXPECT_EQ(!has_video_, IsMonitoring()); 312 EXPECT_EQ(!has_video_, IsMonitoring());
313 EXPECT_FALSE(wtr_->IsSizeLargeEnoughToReportWatchTime());
307 314
308 Initialize(true, false, false, gfx::Size()); 315 Initialize(true, false, false, gfx::Size());
309 wtr_->OnPlaying(); 316 wtr_->OnPlaying();
310 EXPECT_EQ(!has_video_, IsMonitoring()); 317 EXPECT_EQ(!has_video_, IsMonitoring());
318 EXPECT_FALSE(wtr_->IsSizeLargeEnoughToReportWatchTime());
311 319
312 Initialize(true, true, false, gfx::Size()); 320 Initialize(true, true, false, gfx::Size());
313 wtr_->OnPlaying(); 321 wtr_->OnPlaying();
314 EXPECT_EQ(!has_video_, IsMonitoring()); 322 EXPECT_EQ(!has_video_, IsMonitoring());
323 EXPECT_FALSE(wtr_->IsSizeLargeEnoughToReportWatchTime());
315 324
316 if (!has_video_) 325 if (!has_video_)
317 EXPECT_WATCH_TIME_FINALIZED(); 326 EXPECT_WATCH_TIME_FINALIZED();
318 wtr_.reset(); 327 wtr_.reset();
319 } 328 }
320 329
321 TEST_P(WatchTimeReporterTest, WatchTimeReporterBasic) { 330 TEST_P(WatchTimeReporterTest, WatchTimeReporterBasic) {
322 constexpr base::TimeDelta kWatchTimeEarly = base::TimeDelta::FromSeconds(5); 331 constexpr base::TimeDelta kWatchTimeEarly = base::TimeDelta::FromSeconds(5);
323 constexpr base::TimeDelta kWatchTimeLate = base::TimeDelta::FromSeconds(10); 332 constexpr base::TimeDelta kWatchTimeLate = base::TimeDelta::FromSeconds(10);
324 EXPECT_CALL(*this, GetCurrentMediaTime()) 333 EXPECT_CALL(*this, GetCurrentMediaTime())
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 }); 829 });
821 } 830 }
822 } 831 }
823 } 832 }
824 833
825 INSTANTIATE_TEST_CASE_P(WatchTimeReporterTest, 834 INSTANTIATE_TEST_CASE_P(WatchTimeReporterTest,
826 WatchTimeReporterTest, 835 WatchTimeReporterTest,
827 testing::Values(true, false)); 836 testing::Values(true, false));
828 837
829 } // namespace media 838 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/watch_time_reporter.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698