Skip to content

Commit

Permalink
Changed priorities, fixed test - codereview notice
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBarabash committed Oct 24, 2024
1 parent ce6027d commit cdb294c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ public class BraveSafetyNetThreatsPrioritiesTest {
public void testPriorities() throws Exception {
// Fail safe option for empty input, consider it is safe
Assert.assertEquals(
BraveSafeBrowsingUtils.getMostPriorityThreat(new ArrayList<>()),
BraveSafeBrowsingUtils.getHighestPriorityThreat(new ArrayList<>()),
SafetyNetJavaThreatType.MAX_VALUE);

// Single input must return the same value
Assert.assertEquals(
BraveSafeBrowsingUtils.getMostPriorityThreat(
BraveSafeBrowsingUtils.getHighestPriorityThreat(
Arrays.asList(new Integer[] {SafetyNetJavaThreatType.SOCIAL_ENGINEERING})),
SafetyNetJavaThreatType.SOCIAL_ENGINEERING);

// Several threats as input - return the most priority one
Assert.assertEquals(
BraveSafeBrowsingUtils.getMostPriorityThreat(
BraveSafeBrowsingUtils.getHighestPriorityThreat(
Arrays.asList(
new Integer[] {
SafetyNetJavaThreatType.UNWANTED_SOFTWARE,
Expand All @@ -51,7 +51,7 @@ public void testPriorities() throws Exception {
SafetyNetJavaThreatType.SOCIAL_ENGINEERING);

Assert.assertEquals(
BraveSafeBrowsingUtils.getMostPriorityThreat(
BraveSafeBrowsingUtils.getHighestPriorityThreat(
Arrays.asList(
new Integer[] {
SafetyNetJavaThreatType.SUBRESOURCE_FILTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ public static int safetyNetToSafeBrowsingJavaThreatType(int safetyNetThreatType)
// Priorities from most high to low
private static final int SAFETY_NET_THREAT_PRIORITIES[] = {
SafetyNetJavaThreatType.SOCIAL_ENGINEERING,
SafetyNetJavaThreatType.BILLING,
SafetyNetJavaThreatType.POTENTIALLY_HARMFUL_APPLICATION,
SafetyNetJavaThreatType.BILLING,
SafetyNetJavaThreatType.UNWANTED_SOFTWARE,
SafetyNetJavaThreatType.SUBRESOURCE_FILTER,
SafetyNetJavaThreatType.CSD_ALLOWLIST,
Expand Down

0 comments on commit cdb294c

Please sign in to comment.