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

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

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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 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 "media/cast/logging/receiver_time_offset_estimator_impl.h" 5 #include "media/cast/logging/receiver_time_offset_estimator_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/test/simple_test_tick_clock.h" 12 #include "base/test/simple_test_tick_clock.h"
13 #include "base/time/tick_clock.h" 13 #include "base/time/tick_clock.h"
14 #include "media/cast/cast_environment.h" 14 #include "media/cast/cast_environment.h"
15 #include "media/cast/logging/logging_defines.h" 15 #include "media/cast/logging/logging_defines.h"
16 #include "media/cast/test/fake_single_thread_task_runner.h" 16 #include "media/cast/test/fake_single_thread_task_runner.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace media { 19 namespace media {
20 namespace cast { 20 namespace cast {
21 21
22 class ReceiverTimeOffsetEstimatorImplTest : public ::testing::Test { 22 class ReceiverTimeOffsetEstimatorImplTest : public ::testing::Test {
23 protected: 23 protected:
24 ReceiverTimeOffsetEstimatorImplTest() 24 ReceiverTimeOffsetEstimatorImplTest()
25 : sender_clock_(new base::SimpleTestTickClock()), 25 : sender_clock_(new base::SimpleTestTickClock(base::TimeTicks())),
26 task_runner_(new test::FakeSingleThreadTaskRunner(sender_clock_)), 26 task_runner_(new test::FakeSingleThreadTaskRunner(sender_clock_)),
27 cast_environment_( 27 cast_environment_(
28 new CastEnvironment(scoped_ptr<base::TickClock>(sender_clock_), 28 new CastEnvironment(scoped_ptr<base::TickClock>(sender_clock_),
29 task_runner_, 29 task_runner_,
30 task_runner_, 30 task_runner_,
31 task_runner_)) { 31 task_runner_)),
32 receiver_clock_(base::TimeTicks()) {
32 cast_environment_->logger()->Subscribe(&estimator_); 33 cast_environment_->logger()->Subscribe(&estimator_);
33 } 34 }
34 35
35 ~ReceiverTimeOffsetEstimatorImplTest() override { 36 ~ReceiverTimeOffsetEstimatorImplTest() override {
36 cast_environment_->logger()->Unsubscribe(&estimator_); 37 cast_environment_->logger()->Unsubscribe(&estimator_);
37 } 38 }
38 39
39 void AdvanceClocks(base::TimeDelta time) { 40 void AdvanceClocks(base::TimeDelta time) {
40 task_runner_->Sleep(time); 41 task_runner_->Sleep(time);
41 receiver_clock_.Advance(time); 42 receiver_clock_.Advance(time);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 int64_t lower_bound_ms = lower_bound.InMilliseconds(); 395 int64_t lower_bound_ms = lower_bound.InMilliseconds();
395 int64_t upper_bound_ms = upper_bound.InMilliseconds(); 396 int64_t upper_bound_ms = upper_bound.InMilliseconds();
396 EXPECT_GT(lower_bound_ms, 90); 397 EXPECT_GT(lower_bound_ms, 90);
397 EXPECT_LE(lower_bound_ms, true_offset_ms); 398 EXPECT_LE(lower_bound_ms, true_offset_ms);
398 EXPECT_LT(upper_bound_ms, 150); 399 EXPECT_LT(upper_bound_ms, 150);
399 EXPECT_GT(upper_bound_ms, true_offset_ms); 400 EXPECT_GT(upper_bound_ms, true_offset_ms);
400 } 401 }
401 402
402 } // namespace cast 403 } // namespace cast
403 } // namespace media 404 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/encoding_event_subscriber_unittest.cc ('k') | media/cast/logging/simple_event_subscriber_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698