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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 EXPECT_EQ(ERR_IO_PENDING, req1->Resolve()); | 592 EXPECT_EQ(ERR_IO_PENDING, req1->Resolve()); |
593 | 593 |
594 proc_->SignalMultiple(2u); | 594 proc_->SignalMultiple(2u); |
595 | 595 |
596 EXPECT_EQ(OK, req1->WaitForResult()); | 596 EXPECT_EQ(OK, req1->WaitForResult()); |
597 | 597 |
598 // This request was canceled. | 598 // This request was canceled. |
599 EXPECT_FALSE(req0->completed()); | 599 EXPECT_FALSE(req0->completed()); |
600 } | 600 } |
601 | 601 |
602 TEST_F(HostResolverImplTest, NumericIPv4Address) { | 602 #if defined(THREAD_SANITIZER) |
| 603 // Use of WorkerPool in HostResolverImpl causes a data race. crbug.com/334140 |
| 604 #define MAYBE_NumericIPv4Address DISABLED_NumericIPv4Address |
| 605 #else |
| 606 #define MAYBE_NumericIPv4Address NumericIPv4Address |
| 607 #endif |
| 608 TEST_F(HostResolverImplTest, MAYBE_NumericIPv4Address) { |
603 // Stevens says dotted quads with AI_UNSPEC resolve to a single sockaddr_in. | 609 // Stevens says dotted quads with AI_UNSPEC resolve to a single sockaddr_in. |
604 Request* req = CreateRequest("127.1.2.3", 5555); | 610 Request* req = CreateRequest("127.1.2.3", 5555); |
605 EXPECT_EQ(OK, req->Resolve()); | 611 EXPECT_EQ(OK, req->Resolve()); |
606 | 612 |
607 EXPECT_TRUE(req->HasOneAddress("127.1.2.3", 5555)); | 613 EXPECT_TRUE(req->HasOneAddress("127.1.2.3", 5555)); |
608 } | 614 } |
609 | 615 |
610 TEST_F(HostResolverImplTest, NumericIPv6Address) { | 616 #if defined(THREAD_SANITIZER) |
| 617 // Use of WorkerPool in HostResolverImpl causes a data race. crbug.com/334140 |
| 618 #define MAYBE_NumericIPv6Address DISABLED_NumericIPv6Address |
| 619 #else |
| 620 #define MAYBE_NumericIPv6Address NumericIPv6Address |
| 621 #endif |
| 622 TEST_F(HostResolverImplTest, MAYBE_NumericIPv6Address) { |
611 // Resolve a plain IPv6 address. Don't worry about [brackets], because | 623 // Resolve a plain IPv6 address. Don't worry about [brackets], because |
612 // the caller should have removed them. | 624 // the caller should have removed them. |
613 Request* req = CreateRequest("2001:db8::1", 5555); | 625 Request* req = CreateRequest("2001:db8::1", 5555); |
614 EXPECT_EQ(OK, req->Resolve()); | 626 EXPECT_EQ(OK, req->Resolve()); |
615 | 627 |
616 EXPECT_TRUE(req->HasOneAddress("2001:db8::1", 5555)); | 628 EXPECT_TRUE(req->HasOneAddress("2001:db8::1", 5555)); |
617 } | 629 } |
618 | 630 |
619 TEST_F(HostResolverImplTest, EmptyHost) { | 631 #if defined(THREAD_SANITIZER) |
| 632 // Use of WorkerPool in HostResolverImpl causes a data race. crbug.com/334140 |
| 633 #define MAYBE_EmptyHost DISABLED_EmptyHost |
| 634 #else |
| 635 #define MAYBE_EmptyHost EmptyHost |
| 636 #endif |
| 637 TEST_F(HostResolverImplTest, MAYBE_EmptyHost) { |
620 Request* req = CreateRequest(std::string(), 5555); | 638 Request* req = CreateRequest(std::string(), 5555); |
621 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); | 639 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); |
622 } | 640 } |
623 | 641 |
624 #if defined(THREAD_SANITIZER) | 642 #if defined(THREAD_SANITIZER) |
625 // There's a data race in this test that may lead to use-after-free. | 643 // There's a data race in this test that may lead to use-after-free. |
626 // If the test starts to crash without ThreadSanitizer it needs to be disabled | 644 // If the test starts to crash without ThreadSanitizer it needs to be disabled |
627 // globally. See http://crbug.com/268946 (stacks for this test in | 645 // globally. See http://crbug.com/268946 (stacks for this test in |
628 // crbug.com/333567). | 646 // crbug.com/333567). |
629 #define MAYBE_EmptyDotsHost DISABLED_EmptyDotsHost | 647 #define MAYBE_EmptyDotsHost DISABLED_EmptyDotsHost |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 | 2082 |
2065 EXPECT_EQ(OK, requests_[0]->WaitForResult()); | 2083 EXPECT_EQ(OK, requests_[0]->WaitForResult()); |
2066 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); | 2084 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); |
2067 EXPECT_EQ(OK, requests_[1]->WaitForResult()); | 2085 EXPECT_EQ(OK, requests_[1]->WaitForResult()); |
2068 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); | 2086 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); |
2069 EXPECT_EQ(OK, requests_[2]->WaitForResult()); | 2087 EXPECT_EQ(OK, requests_[2]->WaitForResult()); |
2070 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); | 2088 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); |
2071 } | 2089 } |
2072 | 2090 |
2073 } // namespace net | 2091 } // namespace net |
OLD | NEW |