Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: components/certificate_transparency/mock_log_dns_traffic.h

Issue 2389993003: MockLogDnsTraffic now returns bool instead of CHECKing bad arguments (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/certificate_transparency/mock_log_dns_traffic.h
diff --git a/components/certificate_transparency/mock_log_dns_traffic.h b/components/certificate_transparency/mock_log_dns_traffic.h
index 78257d8eeef6ddd6fd2717b05356b0615843b216..7ce4dfeee81d3dcb50bcc38563060b024f86e8cb 100644
--- a/components/certificate_transparency/mock_log_dns_traffic.h
+++ b/components/certificate_transparency/mock_log_dns_traffic.h
@@ -9,10 +9,11 @@
#include <memory>
#include <string>
#include <vector>
+#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "net/dns/dns_client.h"
#include "net/dns/dns_config_service.h"
#include "net/socket/socket_test_util.h"
@@ -48,38 +49,52 @@ class MockLogDnsTraffic {
// Expect a CT DNS request for the domain |qname|.
// Such a request will receive a DNS response indicating that the error
// specified by |rcode| occurred. See RFC1035, Section 4.1.1 for |rcode|
// values.
- void ExpectRequestAndErrorResponse(base::StringPiece qname, uint8_t rcode);
+ // Returns false if any of the arguments are invalid.
+ WARN_UNUSED_RESULT
+ bool ExpectRequestAndErrorResponse(base::StringPiece qname, uint8_t rcode);
// Expect a CT DNS request for the domain |qname|.
// Such a request will trigger a socket error of type |error|.
- void ExpectRequestAndSocketError(base::StringPiece qname, net::Error error);
+ // Returns false if any of the arguments are invalid.
+ WARN_UNUSED_RESULT
+ bool ExpectRequestAndSocketError(base::StringPiece qname, net::Error error);
// Expect a CT DNS request for the domain |qname|.
// Such a request will timeout.
// This will reduce the DNS timeout to minimize test duration.
- void ExpectRequestAndTimeout(base::StringPiece qname);
+ // Returns false if |qname| is invalid.
+ WARN_UNUSED_RESULT
+ bool ExpectRequestAndTimeout(base::StringPiece qname);
// Expect a CT DNS request for the domain |qname|.
// Such a request will receive a DNS TXT response containing |txt_strings|.
- void ExpectRequestAndResponse(
- base::StringPiece qname,
- const std::vector<base::StringPiece>& txt_strings);
+ // Returns false if any of the arguments are invalid.
+ WARN_UNUSED_RESULT
+ bool ExpectRequestAndResponse(
+ base::StringPiece qname,
+ const std::vector<base::StringPiece>& txt_strings);
+
// Expect a CT DNS request for the domain |qname|.
// Such a request will receive a DNS response containing |leaf_index|.
// A description of such a request and response can be seen here:
// https://github.com/google/certificate-transparency-rfcs/blob/c8844de6bd0b5d3d16bac79865e6edef533d760b/dns/draft-ct-over-dns.md#hash-query-hashquery
- void ExpectLeafIndexRequestAndResponse(base::StringPiece qname,
+ // Returns false if any of the arguments are invalid.
+ WARN_UNUSED_RESULT
+ bool ExpectLeafIndexRequestAndResponse(base::StringPiece qname,
uint64_t leaf_index);
+
// Expect a CT DNS request for the domain |qname|.
// Such a request will receive a DNS response containing the inclusion proof
// nodes between |audit_path_start| and |audit_path_end|.
// A description of such a request and response can be seen here:
// https://github.com/google/certificate-transparency-rfcs/blob/c8844de6bd0b5d3d16bac79865e6edef533d760b/dns/draft-ct-over-dns.md#tree-query-treequery
- void ExpectAuditProofRequestAndResponse(
+ // Returns false if any of the arguments are invalid.
+ WARN_UNUSED_RESULT
+ bool ExpectAuditProofRequestAndResponse(
base::StringPiece qname,
std::vector<std::string>::const_iterator audit_path_start,
std::vector<std::string>::const_iterator audit_path_end);
// Sets the initial DNS config appropriate for testing.

Powered by Google App Engine
This is Rietveld 408576698