OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/domain_reliability/util.h" | 5 #include "components/domain_reliability/util.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 private: | 36 private: |
37 base::Timer base_timer_; | 37 base::Timer base_timer_; |
38 }; | 38 }; |
39 | 39 |
40 const struct NetErrorMapping { | 40 const struct NetErrorMapping { |
41 int net_error; | 41 int net_error; |
42 const char* beacon_status; | 42 const char* beacon_status; |
43 } net_error_map[] = { | 43 } net_error_map[] = { |
44 { net::OK, "ok" }, | 44 { net::OK, "ok" }, |
45 { net::ERR_ABORTED, "aborted" }, | |
45 { net::ERR_TIMED_OUT, "tcp.connection.timed_out" }, | 46 { net::ERR_TIMED_OUT, "tcp.connection.timed_out" }, |
46 { net::ERR_CONNECTION_CLOSED, "tcp.connection.closed" }, | 47 { net::ERR_CONNECTION_CLOSED, "tcp.connection.closed" }, |
47 { net::ERR_CONNECTION_RESET, "tcp.connection.reset" }, | 48 { net::ERR_CONNECTION_RESET, "tcp.connection.reset" }, |
48 { net::ERR_CONNECTION_REFUSED, "tcp.connection.refused" }, | 49 { net::ERR_CONNECTION_REFUSED, "tcp.connection.refused" }, |
49 { net::ERR_CONNECTION_ABORTED, "tcp.connection.aborted" }, | 50 { net::ERR_CONNECTION_ABORTED, "tcp.connection.aborted" }, |
50 { net::ERR_CONNECTION_FAILED, "tcp.connection.failed" }, | 51 { net::ERR_CONNECTION_FAILED, "tcp.connection.failed" }, |
51 { net::ERR_NAME_NOT_RESOLVED, "dns" }, | 52 { net::ERR_NAME_NOT_RESOLVED, "dns" }, |
52 { net::ERR_SSL_PROTOCOL_ERROR, "ssl.protocol.error" }, | 53 { net::ERR_SSL_PROTOCOL_ERROR, "ssl.protocol.error" }, |
53 { net::ERR_ADDRESS_INVALID, "tcp.connection.address_invalid" }, | 54 { net::ERR_ADDRESS_INVALID, "tcp.connection.address_invalid" }, |
54 { net::ERR_ADDRESS_UNREACHABLE, "tcp.connection.address_unreachable" }, | 55 { net::ERR_ADDRESS_UNREACHABLE, "tcp.connection.address_unreachable" }, |
pavlos
2014/10/30 22:25:43
Can you add:
NO_SSL_VERSIONS_ENABLED
SSL_VERSION_O
| |
55 { net::ERR_CONNECTION_TIMED_OUT, "tcp.connection.timed_out" }, | 56 { net::ERR_CONNECTION_TIMED_OUT, "tcp.connection.timed_out" }, |
56 { net::ERR_NAME_RESOLUTION_FAILED, "dns" }, | 57 { net::ERR_NAME_RESOLUTION_FAILED, "dns" }, |
pavlos
2014/10/30 22:25:43
Can you add:
NETWORK_ACCESS_DENIED
TEMPORARY_THROT
| |
57 { net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, | 58 { net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, |
58 "ssl.pinned_key_not_in_cert_chain" }, | 59 "ssl.pinned_key_not_in_cert_chain" }, |
pavlos
2014/10/30 22:25:43
CLIENT_AUTH_CERT_TYPE_UNSUPPORTED
ORIGIN_BOUND_CER
| |
59 { net::ERR_CERT_COMMON_NAME_INVALID, "ssl.cert.name_invalid" }, | 60 { net::ERR_CERT_COMMON_NAME_INVALID, "ssl.cert.name_invalid" }, |
60 { net::ERR_CERT_DATE_INVALID, "ssl.cert.date_invalid" }, | 61 { net::ERR_CERT_DATE_INVALID, "ssl.cert.date_invalid" }, |
61 { net::ERR_CERT_AUTHORITY_INVALID, "ssl.cert.authority_invalid" }, | 62 { net::ERR_CERT_AUTHORITY_INVALID, "ssl.cert.authority_invalid" }, |
pavlos
2014/10/30 22:25:43
CERT_NO_REVOCATION_MECHANISM
CERT_UNABLE_TO_CHECK_
| |
62 { net::ERR_CERT_REVOKED, "ssl.cert.revoked" }, | 63 { net::ERR_CERT_REVOKED, "ssl.cert.revoked" }, |
63 { net::ERR_CERT_INVALID, "ssl.cert.invalid" }, | 64 { net::ERR_CERT_INVALID, "ssl.cert.invalid" }, |
pavlos
2014/10/30 22:25:43
CERT_WEAK_SIGNATURE_ALGORITHM
CERT_NON_UNIQUE_NAME
| |
64 { net::ERR_EMPTY_RESPONSE, "http.empty_response" }, | 65 { net::ERR_EMPTY_RESPONSE, "http.empty_response" }, |
pavlos
2014/10/30 22:25:43
ERR_EMPTY_RESPONSE
UNSAFE_REDIRECT
INVALID_RESPONS
| |
65 { net::ERR_SPDY_PING_FAILED, "spdy.ping_failed" }, | 66 { net::ERR_SPDY_PING_FAILED, "spdy.ping_failed" }, |
pavlos
2014/10/30 22:25:43
RESPONSE_HEADERS_TOO_BIG
REQUEST_RANGE_NOT_SATISFI
| |
66 { net::ERR_SPDY_PROTOCOL_ERROR, "spdy.protocol" }, | 67 { net::ERR_SPDY_PROTOCOL_ERROR, "spdy.protocol" }, |
pavlos
2014/10/30 22:25:43
INVALID_AUTH_CREDENTIALS
UNSUPPORTED_AUTH_SCHEME
E
| |
67 { net::ERR_QUIC_PROTOCOL_ERROR, "quic.protocol" }, | 68 { net::ERR_QUIC_PROTOCOL_ERROR, "quic.protocol" }, |
pavlos
2014/10/30 22:25:43
RESPONSE_HEADERS_TRUNCATED
QUIC_HANDSHAKE_FAILED
R
| |
68 { net::ERR_DNS_MALFORMED_RESPONSE, "dns.protocol" }, | 69 { net::ERR_DNS_MALFORMED_RESPONSE, "dns.protocol" }, |
pavlos
2014/10/30 22:25:43
DNS_SERVER_REQUIRES_TCP
| |
69 { net::ERR_DNS_SERVER_FAILED, "dns.server" }, | 70 { net::ERR_DNS_SERVER_FAILED, "dns.server" }, |
70 { net::ERR_DNS_TIMED_OUT, "dns.timed_out" }, | 71 { net::ERR_DNS_TIMED_OUT, "dns.timed_out" }, |
pavlos
2014/10/30 22:25:43
DNS_SEARCH_EMPTY
DNS_SORT_ERROR
| |
71 }; | 72 }; |
72 | 73 |
73 } // namespace | 74 } // namespace |
74 | 75 |
75 // static | 76 // static |
76 bool GetDomainReliabilityBeaconStatus( | 77 bool GetDomainReliabilityBeaconStatus( |
77 int net_error, | 78 int net_error, |
78 int http_response_code, | 79 int http_response_code, |
79 std::string* beacon_status_out) { | 80 std::string* beacon_status_out) { |
80 if (net_error == net::OK) { | 81 if (net_error == net::OK) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 ActualTime::~ActualTime() {} | 130 ActualTime::~ActualTime() {} |
130 | 131 |
131 base::Time ActualTime::Now() { return base::Time::Now(); } | 132 base::Time ActualTime::Now() { return base::Time::Now(); } |
132 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); } | 133 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); } |
133 | 134 |
134 scoped_ptr<MockableTime::Timer> ActualTime::CreateTimer() { | 135 scoped_ptr<MockableTime::Timer> ActualTime::CreateTimer() { |
135 return scoped_ptr<MockableTime::Timer>(new ActualTimer()); | 136 return scoped_ptr<MockableTime::Timer>(new ActualTimer()); |
136 } | 137 } |
137 | 138 |
138 } // namespace domain_reliability | 139 } // namespace domain_reliability |
OLD | NEW |