| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/certificate_transparency/log_dns_client.h" | 5 #include "components/certificate_transparency/log_dns_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void WaitUntilRun() { run_loop_.Run(); } | 106 void WaitUntilRun() { run_loop_.Run(); } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 bool called_; | 109 bool called_; |
| 110 int net_error_; | 110 int net_error_; |
| 111 std::unique_ptr<net::ct::MerkleAuditProof> proof_; | 111 std::unique_ptr<net::ct::MerkleAuditProof> proof_; |
| 112 base::RunLoop run_loop_; | 112 base::RunLoop run_loop_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace |
| 116 |
| 115 class LogDnsClientTest : public ::testing::TestWithParam<net::IoMode> { | 117 class LogDnsClientTest : public ::testing::TestWithParam<net::IoMode> { |
| 116 protected: | 118 protected: |
| 117 LogDnsClientTest() | 119 LogDnsClientTest() |
| 118 : network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) { | 120 : network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) { |
| 119 mock_dns_.SetSocketReadMode(GetParam()); | 121 mock_dns_.SetSocketReadMode(GetParam()); |
| 120 mock_dns_.InitializeDnsConfig(); | 122 mock_dns_.InitializeDnsConfig(); |
| 121 } | 123 } |
| 122 | 124 |
| 123 void QueryLeafIndex(base::StringPiece log_domain, | 125 void QueryLeafIndex(base::StringPiece log_domain, |
| 124 base::StringPiece leaf_hash, | 126 base::StringPiece leaf_hash, |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // Let the DNS config change propogate. | 606 // Let the DNS config change propogate. |
| 605 base::RunLoop().RunUntilIdle(); | 607 base::RunLoop().RunUntilIdle(); |
| 606 EXPECT_THAT(dns_client->GetConfig()->nameservers, Not(IsEmpty())); | 608 EXPECT_THAT(dns_client->GetConfig()->nameservers, Not(IsEmpty())); |
| 607 } | 609 } |
| 608 | 610 |
| 609 INSTANTIATE_TEST_CASE_P(ReadMode, | 611 INSTANTIATE_TEST_CASE_P(ReadMode, |
| 610 LogDnsClientTest, | 612 LogDnsClientTest, |
| 611 ::testing::Values(net::IoMode::ASYNC, | 613 ::testing::Values(net::IoMode::ASYNC, |
| 612 net::IoMode::SYNCHRONOUS)); | 614 net::IoMode::SYNCHRONOUS)); |
| 613 | 615 |
| 614 } // namespace | |
| 615 } // namespace certificate_transparency | 616 } // namespace certificate_transparency |
| OLD | NEW |