| 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..3866cf98b364b8b3b58a0260a0f9ef80e3dcdc21 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,14 @@ 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(kChannelId, audio_config);
|
| + media::cast::transport::CastTransportVideoConfig video_config;
|
| + CastHostMsg_InitializeVideo(kChannelId, video_config);
|
| media::cast::transport::EncodedAudioFrame audio_frame;
|
| audio_frame.codec = media::cast::transport::kPcm16;
|
| audio_frame.frame_id = 1;
|
|
|