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/net/cast_transport_sender_impl.h" |
| 6 |
5 #include <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
6 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
7 | 10 |
8 #include "base/bind.h" | 11 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
10 #include "base/macros.h" | 13 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
12 #include "base/test/simple_test_tick_clock.h" | 15 #include "base/test/simple_test_tick_clock.h" |
13 #include "base/values.h" | 16 #include "base/values.h" |
14 #include "media/cast/net/cast_transport_config.h" | 17 #include "media/cast/net/cast_transport_config.h" |
15 #include "media/cast/net/cast_transport_sender_impl.h" | |
16 #include "media/cast/net/rtcp/rtcp.h" | 18 #include "media/cast/net/rtcp/rtcp.h" |
17 #include "media/cast/test/fake_single_thread_task_runner.h" | 19 #include "media/cast/test/fake_single_thread_task_runner.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
19 | 21 |
20 namespace media { | 22 namespace media { |
21 namespace cast { | 23 namespace cast { |
22 | 24 |
23 namespace { | 25 namespace { |
24 const int64_t kStartMillisecond = INT64_C(12345678900000); | 26 const int64_t kStartMillisecond = INT64_C(12345678900000); |
25 const uint32_t kVideoSsrc = 1; | 27 const uint32_t kVideoSsrc = 1; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 93 } |
92 | 94 |
93 void InitWithOptions() { | 95 void InitWithOptions() { |
94 scoped_ptr<base::DictionaryValue> options( | 96 scoped_ptr<base::DictionaryValue> options( |
95 new base::DictionaryValue); | 97 new base::DictionaryValue); |
96 options->SetBoolean("DHCP", true); | 98 options->SetBoolean("DHCP", true); |
97 options->SetBoolean("disable_wifi_scan", true); | 99 options->SetBoolean("disable_wifi_scan", true); |
98 options->SetBoolean("media_streaming_mode", true); | 100 options->SetBoolean("media_streaming_mode", true); |
99 options->SetInteger("pacer_target_burst_size", 20); | 101 options->SetInteger("pacer_target_burst_size", 20); |
100 options->SetInteger("pacer_max_burst_size", 100); | 102 options->SetInteger("pacer_max_burst_size", 100); |
101 transport_sender_.reset( | 103 transport_sender_.reset(new CastTransportSenderImpl( |
102 new CastTransportSenderImpl(NULL, | 104 NULL, &testing_clock_, net::IPEndPoint(), net::IPEndPoint(), |
103 &testing_clock_, | 105 std::move(options), base::Bind(&UpdateCastTransportStatus), |
104 net::IPEndPoint(), | 106 BulkRawEventsCallback(), base::TimeDelta(), task_runner_, |
105 net::IPEndPoint(), | 107 PacketReceiverCallback(), &transport_)); |
106 options.Pass(), | |
107 base::Bind(&UpdateCastTransportStatus), | |
108 BulkRawEventsCallback(), | |
109 base::TimeDelta(), | |
110 task_runner_, | |
111 PacketReceiverCallback(), | |
112 &transport_)); | |
113 task_runner_->RunTasks(); | 108 task_runner_->RunTasks(); |
114 } | 109 } |
115 | 110 |
116 void InitWithLogging() { | 111 void InitWithLogging() { |
117 transport_sender_.reset(new CastTransportSenderImpl( | 112 transport_sender_.reset(new CastTransportSenderImpl( |
118 NULL, | 113 NULL, |
119 &testing_clock_, | 114 &testing_clock_, |
120 net::IPEndPoint(), | 115 net::IPEndPoint(), |
121 net::IPEndPoint(), | 116 net::IPEndPoint(), |
122 make_scoped_ptr(new base::DictionaryValue), | 117 make_scoped_ptr(new base::DictionaryValue), |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 task_runner_->RunTasks(); | 382 task_runner_->RunTasks(); |
388 EXPECT_EQ(7, transport_.packets_sent()); | 383 EXPECT_EQ(7, transport_.packets_sent()); |
389 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. | 384 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. |
390 | 385 |
391 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); | 386 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); |
392 EXPECT_EQ(2, num_times_logging_callback_called_); | 387 EXPECT_EQ(2, num_times_logging_callback_called_); |
393 } | 388 } |
394 | 389 |
395 } // namespace cast | 390 } // namespace cast |
396 } // namespace media | 391 } // namespace media |
OLD | NEW |