| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 EXPECT_EQ(OK, req->Resolve()); | 614 EXPECT_EQ(OK, req->Resolve()); |
| 615 | 615 |
| 616 EXPECT_TRUE(req->HasOneAddress("2001:db8::1", 5555)); | 616 EXPECT_TRUE(req->HasOneAddress("2001:db8::1", 5555)); |
| 617 } | 617 } |
| 618 | 618 |
| 619 TEST_F(HostResolverImplTest, EmptyHost) { | 619 TEST_F(HostResolverImplTest, EmptyHost) { |
| 620 Request* req = CreateRequest(std::string(), 5555); | 620 Request* req = CreateRequest(std::string(), 5555); |
| 621 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); | 621 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); |
| 622 } | 622 } |
| 623 | 623 |
| 624 TEST_F(HostResolverImplTest, EmptyDotsHost) { | 624 #if defined(THREAD_SANITIZER) |
| 625 // 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 |
| 627 // globally. See http://crbug.com/268946 (stacks for this test in |
| 628 // crbug.com/333567). |
| 629 #define MAYBE_EmptyDotsHost DISABLED_EmptyDotsHost |
| 630 #else |
| 631 #define MAYBE_EmptyDotsHost EmptyDotsHost |
| 632 #endif |
| 633 TEST_F(HostResolverImplTest, MAYBE_EmptyDotsHost) { |
| 625 for (int i = 0; i < 16; ++i) { | 634 for (int i = 0; i < 16; ++i) { |
| 626 Request* req = CreateRequest(std::string(i, '.'), 5555); | 635 Request* req = CreateRequest(std::string(i, '.'), 5555); |
| 627 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); | 636 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); |
| 628 } | 637 } |
| 629 } | 638 } |
| 630 | 639 |
| 631 #if defined(THREAD_SANITIZER) | 640 #if defined(THREAD_SANITIZER) |
| 632 // There's a data race in this test that may lead to use-after-free. | 641 // There's a data race in this test that may lead to use-after-free. |
| 633 // If the test starts to crash without ThreadSanitizer it needs to be disabled | 642 // If the test starts to crash without ThreadSanitizer it needs to be disabled |
| 634 // globally. See http://crbug.com/268946. | 643 // globally. See http://crbug.com/268946. |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 | 2064 |
| 2056 EXPECT_EQ(OK, requests_[0]->WaitForResult()); | 2065 EXPECT_EQ(OK, requests_[0]->WaitForResult()); |
| 2057 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); | 2066 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); |
| 2058 EXPECT_EQ(OK, requests_[1]->WaitForResult()); | 2067 EXPECT_EQ(OK, requests_[1]->WaitForResult()); |
| 2059 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); | 2068 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); |
| 2060 EXPECT_EQ(OK, requests_[2]->WaitForResult()); | 2069 EXPECT_EQ(OK, requests_[2]->WaitForResult()); |
| 2061 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); | 2070 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); |
| 2062 } | 2071 } |
| 2063 | 2072 |
| 2064 } // namespace net | 2073 } // namespace net |
| OLD | NEW |