| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "extensions/browser/api/display_source/display_source_apitestbase.h" | 5 #include "extensions/browser/api/display_source/display_source_apitestbase.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/log/net_log_source.h" |
| 13 #include "net/udp/udp_socket.h" | 14 #include "net/udp/udp_socket.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| 18 using api::display_source::SinkInfo; | 19 using api::display_source::SinkInfo; |
| 19 using api::display_source::SinkState; | 20 using api::display_source::SinkState; |
| 20 using api::display_source::AuthenticationMethod; | 21 using api::display_source::AuthenticationMethod; |
| 21 using api::display_source::SINK_STATE_DISCONNECTED; | 22 using api::display_source::SINK_STATE_DISCONNECTED; |
| 22 using api::display_source::SINK_STATE_CONNECTING; | 23 using api::display_source::SINK_STATE_CONNECTING; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (found_clientport_key != std::string::npos) | 459 if (found_clientport_key != std::string::npos) |
| 459 AdaptMessagePattern(found_clientport_key, kClientPortKey, kUdpPortLength, | 460 AdaptMessagePattern(found_clientport_key, kClientPortKey, kUdpPortLength, |
| 460 udp_port_, pattern); | 461 udp_port_, pattern); |
| 461 | 462 |
| 462 ASSERT_EQ(pattern, message); | 463 ASSERT_EQ(pattern, message); |
| 463 } | 464 } |
| 464 | 465 |
| 465 void MockDisplaySourceConnectionDelegate::BindToUdpSocket() { | 466 void MockDisplaySourceConnectionDelegate::BindToUdpSocket() { |
| 466 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 467 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 467 | 468 |
| 468 socket_.reset(new net::UDPSocket( | 469 socket_.reset(new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND, |
| 469 net::DatagramSocket::DEFAULT_BIND, net::RandIntCallback(), nullptr, | 470 net::RandIntCallback(), nullptr, |
| 470 net::NetLog::Source())); | 471 net::NetLogSource())); |
| 471 | 472 |
| 472 net::IPAddress address; | 473 net::IPAddress address; |
| 473 ASSERT_TRUE(address.AssignFromIPLiteral(kLocalHost)); | 474 ASSERT_TRUE(address.AssignFromIPLiteral(kLocalHost)); |
| 474 | 475 |
| 475 int net_result; | 476 int net_result; |
| 476 net_result = socket_->Open(net::ADDRESS_FAMILY_IPV4); | 477 net_result = socket_->Open(net::ADDRESS_FAMILY_IPV4); |
| 477 ASSERT_EQ(net_result, net::OK); | 478 ASSERT_EQ(net_result, net::OK); |
| 478 | 479 |
| 479 for (uint16_t port = kPortStart; port < kPortEnd; ++port) { | 480 for (uint16_t port = kPortStart; port < kPortEnd; ++port) { |
| 480 net::IPEndPoint local_point(address, port); | 481 net::IPEndPoint local_point(address, port); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 base::Bind(&MockDisplaySourceConnectionDelegate::Disconnect, | 526 base::Bind(&MockDisplaySourceConnectionDelegate::Disconnect, |
| 526 base::Unretained(this), StringCallback())); | 527 base::Unretained(this), StringCallback())); |
| 527 return; | 528 return; |
| 528 } | 529 } |
| 529 | 530 |
| 530 DCHECK(socket_.get()); | 531 DCHECK(socket_.get()); |
| 531 ReceiveMediaPacket(); | 532 ReceiveMediaPacket(); |
| 532 } | 533 } |
| 533 | 534 |
| 534 } // namespace extensions | 535 } // namespace extensions |
| OLD | NEW |