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

Unified Diff: chrome/browser/media/cast_transport_host_filter_unittest.cc

Issue 174183003: Cast:Transport: Dividing A/V Initialization pipeline (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing errors and yet another rebase Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/cast_transport_host_filter.cc ('k') | chrome/common/cast_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/cast_transport_host_filter_unittest.cc
diff --git a/chrome/browser/media/cast_transport_host_filter_unittest.cc b/chrome/browser/media/cast_transport_host_filter_unittest.cc
index 0332dd4f98ce0baff128dd126d483c34c9fe333d..c7139a4f2f7a3c8682e91877f54ea17166180cd8 100644
--- a/chrome/browser/media/cast_transport_host_filter_unittest.cc
+++ b/chrome/browser/media/cast_transport_host_filter_unittest.cc
@@ -16,23 +16,8 @@ class CastTransportHostFilterTest : public testing::Test {
CastTransportHostFilterTest()
: browser_thread_bundle_(
content::TestBrowserThreadBundle::IO_MAINLOOP) {
- }
- protected:
- virtual void SetUp() OVERRIDE {
filter_ = new cast::CastTransportHostFilter();
- }
-
- void FakeSend(const IPC::Message& message) {
- bool message_was_ok;
- EXPECT_TRUE(filter_->OnMessageReceived(message, &message_was_ok));
- EXPECT_TRUE(message_was_ok);
- }
-
- net::IPEndPoint GetLocalEndPoint() {
- return net::IPEndPoint(net::IPAddressNumber(4, 0), 0);
- }
-
- net::IPEndPoint GetRemoteEndPoint() {
+ local_endpoint_ = net::IPEndPoint(net::IPAddressNumber(4, 0), 0);
// 127.0.0.1:7 is the local echo service port, which
// is probably not going to respond, but that's ok.
// TODO(hubbe): Open up an UDP port and make sure
@@ -40,20 +25,26 @@ class CastTransportHostFilterTest : public testing::Test {
net::IPAddressNumber receiver_address(4, 0);
receiver_address[0] = 127;
receiver_address[3] = 1;
- return net::IPEndPoint(receiver_address, 7);
+ receive_endpoint_ = net::IPEndPoint(receiver_address, 7);
+ }
+
+ protected:
+ void FakeSend(const IPC::Message& message) {
+ bool message_was_ok;
+ EXPECT_TRUE(filter_->OnMessageReceived(message, &message_was_ok));
+ EXPECT_TRUE(message_was_ok);
}
content::TestBrowserThreadBundle browser_thread_bundle_;
scoped_refptr<content::BrowserMessageFilter> filter_;
net::IPAddressNumber receiver_address_;
+ net::IPEndPoint local_endpoint_;
+ net::IPEndPoint receive_endpoint_;
};
TEST_F(CastTransportHostFilterTest, NewDelete) {
- media::cast::transport::CastTransportConfig config;
- config.local_endpoint = GetLocalEndPoint();
- config.receiver_endpoint = GetRemoteEndPoint();
const int kChannelId = 17;
- CastHostMsg_New new_msg(kChannelId, config);
+ CastHostMsg_New new_msg(kChannelId, local_endpoint_, receive_endpoint_);
CastHostMsg_Delete delete_msg(kChannelId);
// New, then delete, as expected.
@@ -75,12 +66,8 @@ TEST_F(CastTransportHostFilterTest, NewDelete) {
}
TEST_F(CastTransportHostFilterTest, NewMany) {
- media::cast::transport::CastTransportConfig config;
- config.local_endpoint = GetLocalEndPoint();
- config.receiver_endpoint = GetRemoteEndPoint();
-
for (int i = 0; i < 100; i++) {
- CastHostMsg_New new_msg(i, config);
+ CastHostMsg_New new_msg(i, local_endpoint_, receive_endpoint_);
FakeSend(new_msg);
}
@@ -94,13 +81,17 @@ TEST_F(CastTransportHostFilterTest, NewMany) {
TEST_F(CastTransportHostFilterTest, SimpleMessages) {
// Create a cast transport sender.
- media::cast::transport::CastTransportConfig config;
- config.local_endpoint = GetLocalEndPoint();
- config.receiver_endpoint = GetRemoteEndPoint();
const int32 kChannelId = 42;
- CastHostMsg_New new_msg(kChannelId, config);
+ CastHostMsg_New new_msg(kChannelId, local_endpoint_, receive_endpoint_);
FakeSend(new_msg);
+ media::cast::transport::CastTransportAudioConfig audio_config;
+ CastHostMsg_InitializeAudio init_audio_msg(kChannelId, audio_config);
+ FakeSend(init_audio_msg);
+
+ media::cast::transport::CastTransportVideoConfig video_config;
+ CastHostMsg_InitializeVideo init_video_msg(kChannelId, video_config);
+ FakeSend(init_video_msg);
media::cast::transport::EncodedAudioFrame audio_frame;
audio_frame.codec = media::cast::transport::kPcm16;
audio_frame.frame_id = 1;
@@ -111,7 +102,7 @@ TEST_F(CastTransportHostFilterTest, SimpleMessages) {
audio_frame.data = std::string(kSamples * kBytesPerSample * kChannels, 'q');
CastHostMsg_InsertCodedAudioFrame insert_coded_audio_frame(
kChannelId, audio_frame, base::TimeTicks::Now());
- FakeSend(new_msg);
+ FakeSend(insert_coded_audio_frame);
media::cast::transport::EncodedVideoFrame video_frame;
video_frame.codec = media::cast::transport::kVp8;
@@ -124,7 +115,7 @@ TEST_F(CastTransportHostFilterTest, SimpleMessages) {
video_frame.data = std::string(kVideoDataSize, 'p');
CastHostMsg_InsertCodedVideoFrame insert_coded_video_frame(
kChannelId, video_frame, base::TimeTicks::Now());
- FakeSend(new_msg);
+ FakeSend(insert_coded_video_frame);
media::cast::transport::SendRtcpFromRtpSenderData rtcp_data;
rtcp_data.packet_type_flags = 0;
« no previous file with comments | « chrome/browser/media/cast_transport_host_filter.cc ('k') | chrome/common/cast_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698