| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 void WaitUntilRun() { run_loop_.Run(); } | 109 void WaitUntilRun() { run_loop_.Run(); } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 bool called_; | 112 bool called_; |
| 113 int net_error_; | 113 int net_error_; |
| 114 std::unique_ptr<net::ct::MerkleAuditProof> proof_; | 114 std::unique_ptr<net::ct::MerkleAuditProof> proof_; |
| 115 base::RunLoop run_loop_; | 115 base::RunLoop run_loop_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace |
| 119 |
| 118 class LogDnsClientTest : public ::testing::TestWithParam<net::IoMode> { | 120 class LogDnsClientTest : public ::testing::TestWithParam<net::IoMode> { |
| 119 protected: | 121 protected: |
| 120 LogDnsClientTest() | 122 LogDnsClientTest() |
| 121 : network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) { | 123 : network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) { |
| 122 mock_dns_.SetSocketReadMode(GetParam()); | 124 mock_dns_.SetSocketReadMode(GetParam()); |
| 123 mock_dns_.InitializeDnsConfig(); | 125 mock_dns_.InitializeDnsConfig(); |
| 124 } | 126 } |
| 125 | 127 |
| 126 std::unique_ptr<LogDnsClient> CreateLogDnsClient( | 128 std::unique_ptr<LogDnsClient> CreateLogDnsClient( |
| 127 size_t max_concurrent_queries) { | 129 size_t max_concurrent_queries) { |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 // TODO(robpercival): Enable this once MerkleAuditProof has tree_size. | 804 // TODO(robpercival): Enable this once MerkleAuditProof has tree_size. |
| 803 // EXPECT_THAT(callback3.proof()->tree_size, Eq(999999)); | 805 // EXPECT_THAT(callback3.proof()->tree_size, Eq(999999)); |
| 804 EXPECT_THAT(callback3.proof()->nodes, Eq(audit_proof)); | 806 EXPECT_THAT(callback3.proof()->nodes, Eq(audit_proof)); |
| 805 } | 807 } |
| 806 | 808 |
| 807 INSTANTIATE_TEST_CASE_P(ReadMode, | 809 INSTANTIATE_TEST_CASE_P(ReadMode, |
| 808 LogDnsClientTest, | 810 LogDnsClientTest, |
| 809 ::testing::Values(net::IoMode::ASYNC, | 811 ::testing::Values(net::IoMode::ASYNC, |
| 810 net::IoMode::SYNCHRONOUS)); | 812 net::IoMode::SYNCHRONOUS)); |
| 811 | 813 |
| 812 } // namespace | |
| 813 } // namespace certificate_transparency | 814 } // namespace certificate_transparency |
| OLD | NEW |