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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/time/default_tick_clock.h" | 7 #include "base/time/default_tick_clock.h" |
8 #include "chrome/browser/media/cast_transport_host_filter.h" | 8 #include "chrome/browser/media/cast_transport_host_filter.h" |
9 #include "content/public/test/test_browser_thread_bundle.h" | 9 #include "content/public/test/test_browser_thread_bundle.h" |
10 #include "media/cast/logging/logging_defines.h" | 10 #include "media/cast/logging/logging_defines.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // TODO(hubbe): Open up an UDP port and make sure | 23 // TODO(hubbe): Open up an UDP port and make sure |
24 // we can send and receive packets. | 24 // we can send and receive packets. |
25 net::IPAddressNumber receiver_address(4, 0); | 25 net::IPAddressNumber receiver_address(4, 0); |
26 receiver_address[0] = 127; | 26 receiver_address[0] = 127; |
27 receiver_address[3] = 1; | 27 receiver_address[3] = 1; |
28 receive_endpoint_ = net::IPEndPoint(receiver_address, 7); | 28 receive_endpoint_ = net::IPEndPoint(receiver_address, 7); |
29 } | 29 } |
30 | 30 |
31 protected: | 31 protected: |
32 void FakeSend(const IPC::Message& message) { | 32 void FakeSend(const IPC::Message& message) { |
33 bool message_was_ok; | 33 EXPECT_TRUE(filter_->OnMessageReceived(message)); |
34 EXPECT_TRUE(filter_->OnMessageReceived(message, &message_was_ok)); | |
35 EXPECT_TRUE(message_was_ok); | |
36 } | 34 } |
37 | 35 |
38 content::TestBrowserThreadBundle browser_thread_bundle_; | 36 content::TestBrowserThreadBundle browser_thread_bundle_; |
39 scoped_refptr<content::BrowserMessageFilter> filter_; | 37 scoped_refptr<content::BrowserMessageFilter> filter_; |
40 net::IPAddressNumber receiver_address_; | 38 net::IPAddressNumber receiver_address_; |
41 net::IPEndPoint receive_endpoint_; | 39 net::IPEndPoint receive_endpoint_; |
42 }; | 40 }; |
43 | 41 |
44 TEST_F(CastTransportHostFilterTest, NewDelete) { | 42 TEST_F(CastTransportHostFilterTest, NewDelete) { |
45 const int kChannelId = 17; | 43 const int kChannelId = 17; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 missing_packets[3].insert(7); | 130 missing_packets[3].insert(7); |
133 CastHostMsg_ResendPackets resend_msg( | 131 CastHostMsg_ResendPackets resend_msg( |
134 kChannelId, false, missing_packets); | 132 kChannelId, false, missing_packets); |
135 FakeSend(resend_msg); | 133 FakeSend(resend_msg); |
136 | 134 |
137 CastHostMsg_Delete delete_msg(kChannelId); | 135 CastHostMsg_Delete delete_msg(kChannelId); |
138 FakeSend(delete_msg); | 136 FakeSend(delete_msg); |
139 } | 137 } |
140 | 138 |
141 } // namespace | 139 } // namespace |
OLD | NEW |