| 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 task_runner_ = new test::FakeSingleThreadTaskRunner(&testing_clock_); | 39 task_runner_ = new test::FakeSingleThreadTaskRunner(&testing_clock_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual ~CastTransportSenderImplTest() {} | 42 virtual ~CastTransportSenderImplTest() {} |
| 43 | 43 |
| 44 void InitWithoutLogging() { | 44 void InitWithoutLogging() { |
| 45 transport_sender_.reset( | 45 transport_sender_.reset( |
| 46 new CastTransportSenderImpl(NULL, | 46 new CastTransportSenderImpl(NULL, |
| 47 &testing_clock_, | 47 &testing_clock_, |
| 48 net::IPEndPoint(), | 48 net::IPEndPoint(), |
| 49 GetDefaultCastSenderLoggingConfig(), | |
| 50 base::Bind(&UpdateCastTransportStatus), | 49 base::Bind(&UpdateCastTransportStatus), |
| 51 BulkRawEventsCallback(), | 50 BulkRawEventsCallback(), |
| 52 base::TimeDelta(), | 51 base::TimeDelta(), |
| 53 task_runner_, | 52 task_runner_, |
| 54 &transport_)); | 53 &transport_)); |
| 55 task_runner_->RunTasks(); | 54 task_runner_->RunTasks(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 void InitWithLogging() { | 57 void InitWithLogging() { |
| 59 transport_sender_.reset(new CastTransportSenderImpl( | 58 transport_sender_.reset(new CastTransportSenderImpl( |
| 60 NULL, | 59 NULL, |
| 61 &testing_clock_, | 60 &testing_clock_, |
| 62 net::IPEndPoint(), | 61 net::IPEndPoint(), |
| 63 GetLoggingConfigWithRawEventsAndStatsEnabled(), | |
| 64 base::Bind(&UpdateCastTransportStatus), | 62 base::Bind(&UpdateCastTransportStatus), |
| 65 base::Bind(&CastTransportSenderImplTest::LogRawEvents, | 63 base::Bind(&CastTransportSenderImplTest::LogRawEvents, |
| 66 base::Unretained(this)), | 64 base::Unretained(this)), |
| 67 base::TimeDelta::FromMilliseconds(10), | 65 base::TimeDelta::FromMilliseconds(10), |
| 68 task_runner_, | 66 task_runner_, |
| 69 &transport_)); | 67 &transport_)); |
| 70 task_runner_->RunTasks(); | 68 task_runner_->RunTasks(); |
| 71 } | 69 } |
| 72 | 70 |
| 73 void LogRawEvents(const std::vector<PacketEvent>& packet_events) { | 71 void LogRawEvents(const std::vector<PacketEvent>& packet_events) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 103 message_loop_.PostDelayedTask(FROM_HERE, | 101 message_loop_.PostDelayedTask(FROM_HERE, |
| 104 run_loop_.QuitClosure(), | 102 run_loop_.QuitClosure(), |
| 105 base::TimeDelta::FromMilliseconds(50)); | 103 base::TimeDelta::FromMilliseconds(50)); |
| 106 run_loop_.Run(); | 104 run_loop_.Run(); |
| 107 EXPECT_GT(num_times_callback_called_, 1); | 105 EXPECT_GT(num_times_callback_called_, 1); |
| 108 } | 106 } |
| 109 | 107 |
| 110 } // namespace transport | 108 } // namespace transport |
| 111 } // namespace cast | 109 } // namespace cast |
| 112 } // namespace media | 110 } // namespace media |
| OLD | NEW |