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