| 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 "net/dns/address_sorter_posix.h" | 5 #include "net/dns/address_sorter_posix.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "net/base/ip_address.h" | 10 #include "net/base/ip_address.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (connected_) | 78 if (connected_) |
| 79 return ERR_UNEXPECTED; | 79 return ERR_UNEXPECTED; |
| 80 AddressMapping::const_iterator it = mapping_->find(remote.address()); | 80 AddressMapping::const_iterator it = mapping_->find(remote.address()); |
| 81 if (it == mapping_->end()) | 81 if (it == mapping_->end()) |
| 82 return ERR_FAILED; | 82 return ERR_FAILED; |
| 83 connected_ = true; | 83 connected_ = true; |
| 84 local_endpoint_ = IPEndPoint(it->second, 39874 /* arbitrary port */); | 84 local_endpoint_ = IPEndPoint(it->second, 39874 /* arbitrary port */); |
| 85 return OK; | 85 return OK; |
| 86 } | 86 } |
| 87 | 87 |
| 88 const BoundNetLog& NetLog() const override { return net_log_; } | 88 const NetLogWithSource& NetLog() const override { return net_log_; } |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 BoundNetLog net_log_; | 91 NetLogWithSource net_log_; |
| 92 const AddressMapping* mapping_; | 92 const AddressMapping* mapping_; |
| 93 bool connected_; | 93 bool connected_; |
| 94 IPEndPoint local_endpoint_; | 94 IPEndPoint local_endpoint_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(TestUDPClientSocket); | 96 DISALLOW_COPY_AND_ASSIGN(TestUDPClientSocket); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Creates TestUDPClientSockets and maintains an AddressMapping. | 99 // Creates TestUDPClientSockets and maintains an AddressMapping. |
| 100 class TestSocketFactory : public ClientSocketFactory { | 100 class TestSocketFactory : public ClientSocketFactory { |
| 101 public: | 101 public: |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 AddMapping("4000::1", "4000::10"); // global unicast | 328 AddMapping("4000::1", "4000::10"); // global unicast |
| 329 AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast | 329 AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast |
| 330 GetSourceInfo("fe81::20")->deprecated = true; | 330 GetSourceInfo("fe81::20")->deprecated = true; |
| 331 const char* const addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", | 331 const char* const addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", |
| 332 "::1", "8.0.0.1", NULL }; | 332 "::1", "8.0.0.1", NULL }; |
| 333 const int order[] = { 4, 3, 0, 2, 1, -1 }; | 333 const int order[] = { 4, 3, 0, 2, 1, -1 }; |
| 334 Verify(addresses, order); | 334 Verify(addresses, order); |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // namespace net | 337 } // namespace net |
| OLD | NEW |