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