OLD | NEW |
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/simple_event_subscriber.h" | 5 #include "media/cast/logging/simple_event_subscriber.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/test/simple_test_tick_clock.h" | 11 #include "base/test/simple_test_tick_clock.h" |
12 #include "base/time/tick_clock.h" | 12 #include "base/time/tick_clock.h" |
13 #include "media/cast/cast_environment.h" | 13 #include "media/cast/cast_environment.h" |
14 #include "media/cast/logging/logging_defines.h" | 14 #include "media/cast/logging/logging_defines.h" |
15 #include "media/cast/test/fake_single_thread_task_runner.h" | 15 #include "media/cast/test/fake_single_thread_task_runner.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 namespace cast { | 19 namespace cast { |
20 | 20 |
21 class SimpleEventSubscriberTest : public ::testing::Test { | 21 class SimpleEventSubscriberTest : public ::testing::Test { |
22 protected: | 22 protected: |
23 SimpleEventSubscriberTest() | 23 SimpleEventSubscriberTest() |
24 : testing_clock_(new base::SimpleTestTickClock()), | 24 : testing_clock_(new base::SimpleTestTickClock(base::TimeTicks())), |
25 task_runner_(new test::FakeSingleThreadTaskRunner(testing_clock_)), | 25 task_runner_(new test::FakeSingleThreadTaskRunner(testing_clock_)), |
26 cast_environment_( | 26 cast_environment_( |
27 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_), | 27 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_), |
28 task_runner_, | 28 task_runner_, |
29 task_runner_, | 29 task_runner_, |
30 task_runner_)) { | 30 task_runner_)) { |
31 cast_environment_->logger()->Subscribe(&event_subscriber_); | 31 cast_environment_->logger()->Subscribe(&event_subscriber_); |
32 } | 32 } |
33 | 33 |
34 ~SimpleEventSubscriberTest() override { | 34 ~SimpleEventSubscriberTest() override { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Calling this function again should result in empty vector because no events | 107 // Calling this function again should result in empty vector because no events |
108 // were logged since last call. | 108 // were logged since last call. |
109 event_subscriber_.GetFrameEventsAndReset(&frame_events); | 109 event_subscriber_.GetFrameEventsAndReset(&frame_events); |
110 event_subscriber_.GetPacketEventsAndReset(&packet_events); | 110 event_subscriber_.GetPacketEventsAndReset(&packet_events); |
111 EXPECT_TRUE(frame_events.empty()); | 111 EXPECT_TRUE(frame_events.empty()); |
112 EXPECT_TRUE(packet_events.empty()); | 112 EXPECT_TRUE(packet_events.empty()); |
113 } | 113 } |
114 | 114 |
115 } // namespace cast | 115 } // namespace cast |
116 } // namespace media | 116 } // namespace media |
OLD | NEW |