OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 delete (*it); | 176 delete (*it); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 // Test StartUpdating() and StopUpdating(). network_permission_state starts with | 180 // Test StartUpdating() and StopUpdating(). network_permission_state starts with |
181 // ALLOWED. | 181 // ALLOWED. |
182 TEST_F(NetworkTest, TestUpdateNetworks) { | 182 TEST_F(NetworkTest, TestUpdateNetworks) { |
183 BasicNetworkManager manager; | 183 BasicNetworkManager manager; |
184 manager.SignalNetworksChanged.connect( | 184 manager.SignalNetworksChanged.connect( |
185 static_cast<NetworkTest*>(this), &NetworkTest::OnNetworksChanged); | 185 static_cast<NetworkTest*>(this), &NetworkTest::OnNetworksChanged); |
186 EXPECT_EQ(manager.enumeration_permission(), | 186 EXPECT_EQ(NetworkManager::ENUMERATION_ALLOWED, |
187 NetworkManager::kEnumerationAllowed); | 187 manager.enumeration_permission()); |
188 manager.StartUpdating(); | 188 manager.StartUpdating(); |
189 Thread::Current()->ProcessMessages(0); | 189 Thread::Current()->ProcessMessages(0); |
190 EXPECT_TRUE(callback_called_); | 190 EXPECT_TRUE(callback_called_); |
191 callback_called_ = false; | 191 callback_called_ = false; |
192 // Callback should be triggered immediately when StartUpdating | 192 // Callback should be triggered immediately when StartUpdating |
193 // is called, after network update signal is already sent. | 193 // is called, after network update signal is already sent. |
194 manager.StartUpdating(); | 194 manager.StartUpdating(); |
195 EXPECT_TRUE(manager.started()); | 195 EXPECT_TRUE(manager.started()); |
196 Thread::Current()->ProcessMessages(0); | 196 Thread::Current()->ProcessMessages(0); |
197 EXPECT_TRUE(callback_called_); | 197 EXPECT_TRUE(callback_called_); |
198 manager.StopUpdating(); | 198 manager.StopUpdating(); |
199 EXPECT_TRUE(manager.started()); | 199 EXPECT_TRUE(manager.started()); |
200 manager.StopUpdating(); | 200 manager.StopUpdating(); |
201 EXPECT_EQ(manager.enumeration_permission(), | 201 EXPECT_EQ(NetworkManager::ENUMERATION_ALLOWED, |
202 NetworkManager::kEnumerationAllowed); | 202 manager.enumeration_permission()); |
203 EXPECT_FALSE(manager.started()); | 203 EXPECT_FALSE(manager.started()); |
204 manager.StopUpdating(); | 204 manager.StopUpdating(); |
205 EXPECT_FALSE(manager.started()); | 205 EXPECT_FALSE(manager.started()); |
206 callback_called_ = false; | 206 callback_called_ = false; |
207 // Callback should be triggered immediately after StartUpdating is called | 207 // Callback should be triggered immediately after StartUpdating is called |
208 // when start_count_ is reset to 0. | 208 // when start_count_ is reset to 0. |
209 manager.StartUpdating(); | 209 manager.StartUpdating(); |
210 Thread::Current()->ProcessMessages(0); | 210 Thread::Current()->ProcessMessages(0); |
211 EXPECT_TRUE(callback_called_); | 211 EXPECT_TRUE(callback_called_); |
212 } | 212 } |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 EXPECT_EQ(ipv6_network.GetBestIP(), static_cast<IPAddress>(ip)); | 784 EXPECT_EQ(ipv6_network.GetBestIP(), static_cast<IPAddress>(ip)); |
785 | 785 |
786 // Add global dynamic temporary one. | 786 // Add global dynamic temporary one. |
787 ipstr = "2401:fa00:4:1000:be30:5bff:fee5:c6"; | 787 ipstr = "2401:fa00:4:1000:be30:5bff:fee5:c6"; |
788 ASSERT_TRUE(IPFromString(ipstr, IPV6_ADDRESS_FLAG_TEMPORARY, &ip)); | 788 ASSERT_TRUE(IPFromString(ipstr, IPV6_ADDRESS_FLAG_TEMPORARY, &ip)); |
789 ipv6_network.AddIP(ip); | 789 ipv6_network.AddIP(ip); |
790 EXPECT_EQ(ipv6_network.GetBestIP(), static_cast<IPAddress>(ip)); | 790 EXPECT_EQ(ipv6_network.GetBestIP(), static_cast<IPAddress>(ip)); |
791 } | 791 } |
792 | 792 |
793 } // namespace rtc | 793 } // namespace rtc |
OLD | NEW |