Commit 070dc150 authored by kcarattini's avatar kcarattini Committed by Commit bot

SafeBrowsing UMA: Adds an inconsistent threat type histogram bucket.

BUG=561867

Review URL: https://codereview.chromium.org/1624853005

Cr-Commit-Position: refs/heads/master@{#371959}
parent 028688f6
...@@ -90,13 +90,17 @@ enum ParseResultType { ...@@ -90,13 +90,17 @@ enum ParseResultType {
// A match in the response had an unexpected PLATFORM_TYPE. // A match in the response had an unexpected PLATFORM_TYPE.
UNEXPECTED_PLATFORM_TYPE_ERROR = 3, UNEXPECTED_PLATFORM_TYPE_ERROR = 3,
// A match in teh response contained no metadata where metadata was // A match in the response contained no metadata where metadata was
// expected. // expected.
NO_METADATA_ERROR = 4, NO_METADATA_ERROR = 4,
// A match in the response contained a ThreatType that was inconsistent
// with the other matches.
INCONSISTENT_THREAT_TYPE_ERROR = 5,
// Memory space for histograms is determined by the max. ALWAYS // Memory space for histograms is determined by the max. ALWAYS
// ADD NEW VALUES BEFORE THIS ONE. // ADD NEW VALUES BEFORE THIS ONE.
PARSE_GET_HASH_RESULT_MAX = 5 PARSE_GET_HASH_RESULT_MAX = 6
}; };
// Record parsing errors of a GetHash result. // Record parsing errors of a GetHash result.
...@@ -374,14 +378,14 @@ bool SafeBrowsingProtocolManager::ParseV4HashResponse( ...@@ -374,14 +378,14 @@ bool SafeBrowsingProtocolManager::ParseV4HashResponse(
} }
if (!match.has_threat_type()) { if (!match.has_threat_type()) {
// TODO(kcarattini): Add UMA. RecordParseGetHashResult(UNEXPECTED_THREAT_TYPE_ERROR);
return false; return false;
} }
if (expected_threat_type == THREAT_TYPE_UNSPECIFIED) { if (expected_threat_type == THREAT_TYPE_UNSPECIFIED) {
expected_threat_type = match.threat_type(); expected_threat_type = match.threat_type();
} else if (match.threat_type() != expected_threat_type) { } else if (match.threat_type() != expected_threat_type) {
// TODO(kcarattini): Add UMA. RecordParseGetHashResult(INCONSISTENT_THREAT_TYPE_ERROR);
return false; return false;
} }
...@@ -396,7 +400,7 @@ bool SafeBrowsingProtocolManager::ParseV4HashResponse( ...@@ -396,7 +400,7 @@ bool SafeBrowsingProtocolManager::ParseV4HashResponse(
} }
// Different threat types will handle the metadata differently. // Different threat types will handle the metadata differently.
if (match.has_threat_type() && match.threat_type() == API_ABUSE) { if (match.threat_type() == API_ABUSE) {
if (match.has_platform_type() && if (match.has_platform_type() &&
match.platform_type() == CHROME_PLATFORM) { match.platform_type() == CHROME_PLATFORM) {
if (match.has_threat_entry_metadata()) { if (match.has_threat_entry_metadata()) {
......
...@@ -76414,6 +76414,7 @@ To add a new entry, add it with any value and run test to compute valid value. ...@@ -76414,6 +76414,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="2" label="UNEXPECTED_THREAT_TYPE_ERROR"/> <int value="2" label="UNEXPECTED_THREAT_TYPE_ERROR"/>
<int value="3" label="UNEXPECTED_PLATFORM_TYPE_ERROR"/> <int value="3" label="UNEXPECTED_PLATFORM_TYPE_ERROR"/>
<int value="4" label="NO_METADATA_ERROR"/> <int value="4" label="NO_METADATA_ERROR"/>
<int value="5" label="INCONSISTENT_THREAT_TYPE_ERROR"/>
</enum> </enum>
<enum name="SavePasswordPromptResponseType" type="int"> <enum name="SavePasswordPromptResponseType" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment