| 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 <unordered_set> |
| 5 #include <vector> | 6 #include <vector> |
| 6 | 7 |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/synchronization/spin_wait.h" | 10 #include "base/synchronization/spin_wait.h" |
| 10 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 11 #include "base/threading/simple_thread.h" | 12 #include "base/threading/simple_thread.h" |
| 12 #include "net/base/address_tracker_linux.h" | 13 #include "net/base/address_tracker_linux.h" |
| 13 #include "net/base/ip_address.h" | 14 #include "net/base/ip_address.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 tracker_->HandleMessage(&writable_buf[0], buf.size(), | 94 tracker_->HandleMessage(&writable_buf[0], buf.size(), |
| 94 &address_changed, &link_changed, &tunnel_changed); | 95 &address_changed, &link_changed, &tunnel_changed); |
| 95 EXPECT_FALSE(address_changed); | 96 EXPECT_FALSE(address_changed); |
| 96 return tunnel_changed; | 97 return tunnel_changed; |
| 97 } | 98 } |
| 98 | 99 |
| 99 AddressTrackerLinux::AddressMap GetAddressMap() { | 100 AddressTrackerLinux::AddressMap GetAddressMap() { |
| 100 return tracker_->GetAddressMap(); | 101 return tracker_->GetAddressMap(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 const base::hash_set<int> GetOnlineLinks() const { | 104 const std::unordered_set<int> GetOnlineLinks() const { |
| 104 return tracker_->GetOnlineLinks(); | 105 return tracker_->GetOnlineLinks(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 void IgnoreInterface(const std::string& interface_name) { | 108 void IgnoreInterface(const std::string& interface_name) { |
| 108 ignored_interfaces_.insert(interface_name); | 109 ignored_interfaces_.insert(interface_name); |
| 109 } | 110 } |
| 110 | 111 |
| 111 int GetThreadsWaitingForConnectionTypeInit() { | 112 int GetThreadsWaitingForConnectionTypeInit() { |
| 112 return tracker_->GetThreadsWaitingForConnectionTypeInitForTesting(); | 113 return tracker_->GetThreadsWaitingForConnectionTypeInitForTesting(); |
| 113 } | 114 } |
| 114 | 115 |
| 115 base::hash_set<std::string> ignored_interfaces_; | 116 std::unordered_set<std::string> ignored_interfaces_; |
| 116 scoped_ptr<AddressTrackerLinux> tracker_; | 117 scoped_ptr<AddressTrackerLinux> tracker_; |
| 117 AddressTrackerLinux::GetInterfaceNameFunction original_get_interface_name_; | 118 AddressTrackerLinux::GetInterfaceNameFunction original_get_interface_name_; |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 namespace { | 121 namespace { |
| 121 | 122 |
| 122 class NetlinkMessage { | 123 class NetlinkMessage { |
| 123 public: | 124 public: |
| 124 explicit NetlinkMessage(uint16_t type) : buffer_(NLMSG_HDRLEN) { | 125 explicit NetlinkMessage(uint16_t type) : buffer_(NLMSG_HDRLEN) { |
| 125 header()->nlmsg_type = type; | 126 header()->nlmsg_type = type; |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 tracker_->Init(); | 730 tracker_->Init(); |
| 730 | 731 |
| 731 runner1.VerifyCompletes(); | 732 runner1.VerifyCompletes(); |
| 732 runner2.VerifyCompletes(); | 733 runner2.VerifyCompletes(); |
| 733 } | 734 } |
| 734 | 735 |
| 735 } // namespace | 736 } // namespace |
| 736 | 737 |
| 737 } // namespace internal | 738 } // namespace internal |
| 738 } // namespace net | 739 } // namespace net |
| OLD | NEW |