| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/p2p/socket_host_tcp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/run_loop.h" |
| 13 #include "base/sys_byteorder.h" | 14 #include "base/sys_byteorder.h" |
| 14 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" | 15 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" |
| 15 #include "net/socket/stream_socket.h" | 16 #include "net/socket/stream_socket.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 using ::testing::_; | 20 using ::testing::_; |
| 20 using ::testing::DeleteArg; | 21 using ::testing::DeleteArg; |
| 21 using ::testing::DoAll; | 22 using ::testing::DoAll; |
| 22 using ::testing::Return; | 23 using ::testing::Return; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 rtc::PacketOptions options; | 231 rtc::PacketOptions options; |
| 231 std::vector<char> packet1; | 232 std::vector<char> packet1; |
| 232 CreateStunRequest(&packet1); | 233 CreateStunRequest(&packet1); |
| 233 | 234 |
| 234 socket_host_->Send(dest_.ip_address, packet1, options, 0); | 235 socket_host_->Send(dest_.ip_address, packet1, options, 0); |
| 235 | 236 |
| 236 std::vector<char> packet2; | 237 std::vector<char> packet2; |
| 237 CreateStunResponse(&packet2); | 238 CreateStunResponse(&packet2); |
| 238 socket_host_->Send(dest_.ip_address, packet2, options, 0); | 239 socket_host_->Send(dest_.ip_address, packet2, options, 0); |
| 239 | 240 |
| 240 message_loop.RunUntilIdle(); | 241 base::RunLoop().RunUntilIdle(); |
| 241 | 242 |
| 242 std::string expected_data; | 243 std::string expected_data; |
| 243 expected_data.append(IntToSize(packet1.size())); | 244 expected_data.append(IntToSize(packet1.size())); |
| 244 expected_data.append(packet1.begin(), packet1.end()); | 245 expected_data.append(packet1.begin(), packet1.end()); |
| 245 expected_data.append(IntToSize(packet2.size())); | 246 expected_data.append(IntToSize(packet2.size())); |
| 246 expected_data.append(packet2.begin(), packet2.end()); | 247 expected_data.append(packet2.begin(), packet2.end()); |
| 247 | 248 |
| 248 EXPECT_EQ(expected_data, sent_data_); | 249 EXPECT_EQ(expected_data, sent_data_); |
| 249 } | 250 } |
| 250 | 251 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 386 |
| 386 rtc::PacketOptions options; | 387 rtc::PacketOptions options; |
| 387 std::vector<char> packet1; | 388 std::vector<char> packet1; |
| 388 CreateStunRequest(&packet1); | 389 CreateStunRequest(&packet1); |
| 389 socket_host_->Send(dest_.ip_address, packet1, options, 0); | 390 socket_host_->Send(dest_.ip_address, packet1, options, 0); |
| 390 | 391 |
| 391 std::vector<char> packet2; | 392 std::vector<char> packet2; |
| 392 CreateStunResponse(&packet2); | 393 CreateStunResponse(&packet2); |
| 393 socket_host_->Send(dest_.ip_address, packet2, options, 0); | 394 socket_host_->Send(dest_.ip_address, packet2, options, 0); |
| 394 | 395 |
| 395 message_loop.RunUntilIdle(); | 396 base::RunLoop().RunUntilIdle(); |
| 396 | 397 |
| 397 std::string expected_data; | 398 std::string expected_data; |
| 398 expected_data.append(packet1.begin(), packet1.end()); | 399 expected_data.append(packet1.begin(), packet1.end()); |
| 399 expected_data.append(packet2.begin(), packet2.end()); | 400 expected_data.append(packet2.begin(), packet2.end()); |
| 400 | 401 |
| 401 EXPECT_EQ(expected_data, sent_data_); | 402 EXPECT_EQ(expected_data, sent_data_); |
| 402 } | 403 } |
| 403 | 404 |
| 404 } // namespace content | 405 } // namespace content |
| OLD | NEW |