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

Side by Side Diff: media/cast/logging/stats_event_subscriber_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, 11 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/stats_event_subscriber.h" 5 #include "media/cast/logging/stats_event_subscriber.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 12 matching lines...) Expand all
23 namespace { 23 namespace {
24 const int kReceiverOffsetSecs = 100; 24 const int kReceiverOffsetSecs = 100;
25 } 25 }
26 26
27 namespace media { 27 namespace media {
28 namespace cast { 28 namespace cast {
29 29
30 class StatsEventSubscriberTest : public ::testing::Test { 30 class StatsEventSubscriberTest : public ::testing::Test {
31 protected: 31 protected:
32 StatsEventSubscriberTest() 32 StatsEventSubscriberTest()
33 : sender_clock_(new base::SimpleTestTickClock()), 33 : sender_clock_(new base::SimpleTestTickClock(base::TimeTicks())),
34 receiver_clock_(base::TimeTicks() +
35 base::TimeDelta::FromSeconds(kReceiverOffsetSecs)),
34 task_runner_(new test::FakeSingleThreadTaskRunner(sender_clock_)), 36 task_runner_(new test::FakeSingleThreadTaskRunner(sender_clock_)),
35 cast_environment_( 37 cast_environment_(
36 new CastEnvironment(scoped_ptr<base::TickClock>(sender_clock_), 38 new CastEnvironment(scoped_ptr<base::TickClock>(sender_clock_),
37 task_runner_, 39 task_runner_,
38 task_runner_, 40 task_runner_,
39 task_runner_)), 41 task_runner_)),
40 fake_offset_estimator_( 42 fake_offset_estimator_(
41 base::TimeDelta::FromSeconds(kReceiverOffsetSecs)) { 43 base::TimeDelta::FromSeconds(kReceiverOffsetSecs)) {
42 receiver_clock_.Advance(base::TimeDelta::FromSeconds(kReceiverOffsetSecs));
43 cast_environment_->logger()->Subscribe(&fake_offset_estimator_); 44 cast_environment_->logger()->Subscribe(&fake_offset_estimator_);
44 } 45 }
45 46
46 ~StatsEventSubscriberTest() override { 47 ~StatsEventSubscriberTest() override {
47 if (subscriber_.get()) 48 if (subscriber_.get())
48 cast_environment_->logger()->Unsubscribe(subscriber_.get()); 49 cast_environment_->logger()->Unsubscribe(subscriber_.get());
49 cast_environment_->logger()->Unsubscribe(&fake_offset_estimator_); 50 cast_environment_->logger()->Unsubscribe(&fake_offset_estimator_);
50 } 51 }
51 52
52 void AdvanceClocks(base::TimeDelta delta) { 53 void AdvanceClocks(base::TimeDelta delta) {
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 691
691 histogram = subscriber_->GetHistogramForTesting( 692 histogram = subscriber_->GetHistogramForTesting(
692 StatsEventSubscriber::LATE_FRAME_MS_HISTO); 693 StatsEventSubscriber::LATE_FRAME_MS_HISTO);
693 ASSERT_TRUE(histogram); 694 ASSERT_TRUE(histogram);
694 values = histogram->GetHistogram(); 695 values = histogram->GetHistogram();
695 EXPECT_TRUE(CheckHistogramHasValue(values.get(), "100-119", 1)); 696 EXPECT_TRUE(CheckHistogramHasValue(values.get(), "100-119", 1));
696 } 697 }
697 698
698 } // namespace cast 699 } // namespace cast
699 } // namespace media 700 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/simple_event_subscriber_unittest.cc ('k') | media/cast/net/cast_transport_sender_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698