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

Side by Side Diff: media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc

Issue 482383005: Cast logging: Additional stats for getStats() API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@REAL-NEW-MASTER
Patch Set: Rebase Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/test/simple_test_tick_clock.h" 7 #include "base/test/simple_test_tick_clock.h"
8 #include "base/time/tick_clock.h" 8 #include "base/time/tick_clock.h"
9 #include "media/cast/cast_environment.h" 9 #include "media/cast/cast_environment.h"
10 #include "media/cast/logging/logging_defines.h" 10 #include "media/cast/logging/logging_defines.h"
11 #include "media/cast/logging/receiver_time_offset_estimator_impl.h" 11 #include "media/cast/logging/receiver_time_offset_estimator_impl.h"
12 #include "media/cast/test/fake_single_thread_task_runner.h" 12 #include "media/cast/test/fake_single_thread_task_runner.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace media { 15 namespace media {
16 namespace cast { 16 namespace cast {
17 17
18 class ReceiverTimeOffsetEstimatorImplTest : public ::testing::Test { 18 class ReceiverTimeOffsetEstimatorImplTest : public ::testing::Test {
19 protected: 19 protected:
20 ReceiverTimeOffsetEstimatorImplTest() 20 ReceiverTimeOffsetEstimatorImplTest()
21 : sender_clock_(new base::SimpleTestTickClock()), 21 : sender_clock_(new base::SimpleTestTickClock()),
22 task_runner_(new test::FakeSingleThreadTaskRunner(sender_clock_)), 22 task_runner_(new test::FakeSingleThreadTaskRunner(sender_clock_)),
23 cast_environment_(new CastEnvironment( 23 cast_environment_(new CastEnvironment(
24 scoped_ptr<base::TickClock>(sender_clock_).Pass(), 24 scoped_ptr<base::TickClock>(sender_clock_).Pass(),
25 task_runner_, 25 task_runner_,
26 task_runner_, 26 task_runner_,
27 task_runner_)) { 27 task_runner_)),
28 estimator_(cast_environment_->Clock()) {
28 cast_environment_->Logging()->AddRawEventSubscriber(&estimator_); 29 cast_environment_->Logging()->AddRawEventSubscriber(&estimator_);
29 } 30 }
30 31
31 virtual ~ReceiverTimeOffsetEstimatorImplTest() { 32 virtual ~ReceiverTimeOffsetEstimatorImplTest() {
32 cast_environment_->Logging()->RemoveRawEventSubscriber(&estimator_); 33 cast_environment_->Logging()->RemoveRawEventSubscriber(&estimator_);
33 } 34 }
34 35
35 void AdvanceClocks(base::TimeDelta time) { 36 void AdvanceClocks(base::TimeDelta time) {
36 sender_clock_->Advance(time); 37 sender_clock_->Advance(time);
37 receiver_clock_.Advance(time); 38 receiver_clock_.Advance(time);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 int64 lower_bound_ms = lower_bound.InMilliseconds(); 234 int64 lower_bound_ms = lower_bound.InMilliseconds();
234 int64 upper_bound_ms = upper_bound.InMilliseconds(); 235 int64 upper_bound_ms = upper_bound.InMilliseconds();
235 EXPECT_EQ(95, lower_bound_ms); 236 EXPECT_EQ(95, lower_bound_ms);
236 EXPECT_EQ(103, upper_bound_ms); 237 EXPECT_EQ(103, upper_bound_ms);
237 EXPECT_GE(true_offset_ms, lower_bound_ms); 238 EXPECT_GE(true_offset_ms, lower_bound_ms);
238 EXPECT_LE(true_offset_ms, upper_bound_ms); 239 EXPECT_LE(true_offset_ms, upper_bound_ms);
239 } 240 }
240 241
241 } // namespace cast 242 } // namespace cast
242 } // namespace media 243 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/receiver_time_offset_estimator_impl.cc ('k') | media/cast/logging/stats_event_subscriber.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698