| 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/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 proc_->SignalMultiple(3u); | 2400 proc_->SignalMultiple(3u); |
| 2401 | 2401 |
| 2402 EXPECT_THAT(requests_[0]->WaitForResult(), IsOk()); | 2402 EXPECT_THAT(requests_[0]->WaitForResult(), IsOk()); |
| 2403 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); | 2403 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); |
| 2404 EXPECT_THAT(requests_[1]->WaitForResult(), IsOk()); | 2404 EXPECT_THAT(requests_[1]->WaitForResult(), IsOk()); |
| 2405 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); | 2405 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); |
| 2406 EXPECT_THAT(requests_[2]->WaitForResult(), IsOk()); | 2406 EXPECT_THAT(requests_[2]->WaitForResult(), IsOk()); |
| 2407 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); | 2407 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); |
| 2408 } | 2408 } |
| 2409 | 2409 |
| 2410 // TODO(crbug.com/728808): This test causes HttpNetworkTransactionTests to crash | 2410 TEST_F(HostResolverImplDnsTest, NoIPv6OnWifi) { |
| 2411 // on iOS. | 2411 // CreateSerialResolver will destroy the current resolver_ which will attempt |
| 2412 #if defined(OS_IOS) | 2412 // to remove itself from the NetworkChangeNotifier. If this happens after a |
| 2413 #define MAYBE_NoIPv6OnWifi DISABLED_NoIPv6OnWifi | 2413 // new NetworkChangeNotifier is active, then it will not remove itself from |
| 2414 #else | 2414 // the old NetworkChangeNotifier which is a potential use-after-free. |
| 2415 #define MAYBE_NoIPv6OnWifi NoIPv6OnWifi | 2415 resolver_ = nullptr; |
| 2416 #endif | |
| 2417 TEST_F(HostResolverImplDnsTest, MAYBE_NoIPv6OnWifi) { | |
| 2418 test::ScopedMockNetworkChangeNotifier notifier; | 2416 test::ScopedMockNetworkChangeNotifier notifier; |
| 2419 CreateSerialResolver(); // To guarantee order of resolutions. | 2417 CreateSerialResolver(); // To guarantee order of resolutions. |
| 2420 resolver_->SetNoIPv6OnWifi(true); | 2418 resolver_->SetNoIPv6OnWifi(true); |
| 2421 | 2419 |
| 2422 notifier.mock_network_change_notifier()->SetConnectionType( | 2420 notifier.mock_network_change_notifier()->SetConnectionType( |
| 2423 NetworkChangeNotifier::CONNECTION_WIFI); | 2421 NetworkChangeNotifier::CONNECTION_WIFI); |
| 2424 // Needed so IPv6 availability check isn't skipped. | 2422 // Needed so IPv6 availability check isn't skipped. |
| 2425 ChangeDnsConfig(CreateValidDnsConfig()); | 2423 ChangeDnsConfig(CreateValidDnsConfig()); |
| 2426 | 2424 |
| 2427 proc_->AddRule("h1", ADDRESS_FAMILY_UNSPECIFIED, "::3"); | 2425 proc_->AddRule("h1", ADDRESS_FAMILY_UNSPECIFIED, "::3"); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 EXPECT_EQ(1, count2); | 2605 EXPECT_EQ(1, count2); |
| 2608 | 2606 |
| 2609 // Make another request to make sure both callbacks were cleared. | 2607 // Make another request to make sure both callbacks were cleared. |
| 2610 req = CreateRequest("just.testing", 80); | 2608 req = CreateRequest("just.testing", 80); |
| 2611 EXPECT_THAT(req->Resolve(), IsOk()); | 2609 EXPECT_THAT(req->Resolve(), IsOk()); |
| 2612 EXPECT_EQ(2, count1); | 2610 EXPECT_EQ(2, count1); |
| 2613 EXPECT_EQ(1, count2); | 2611 EXPECT_EQ(1, count2); |
| 2614 } | 2612 } |
| 2615 | 2613 |
| 2616 } // namespace net | 2614 } // namespace net |
| OLD | NEW |