From cdb294ccfe8e78f31fe4404b4bd3264f885049a5 Mon Sep 17 00:00:00 2001 From: AlexeyBarabash Date: Fri, 25 Oct 2024 01:03:55 +0300 Subject: [PATCH] Changed priorities, fixed test - codereview notice --- .../browser/BraveSafetyNetThreatsPrioritiesTest.java | 8 ++++---- .../components/safe_browsing/BraveSafeBrowsingUtils.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/javatests/org/chromium/chrome/browser/BraveSafetyNetThreatsPrioritiesTest.java b/android/javatests/org/chromium/chrome/browser/BraveSafetyNetThreatsPrioritiesTest.java index 0858f931f46e..d2e2490f3a9c 100644 --- a/android/javatests/org/chromium/chrome/browser/BraveSafetyNetThreatsPrioritiesTest.java +++ b/android/javatests/org/chromium/chrome/browser/BraveSafetyNetThreatsPrioritiesTest.java @@ -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, @@ -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, diff --git a/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/BraveSafeBrowsingUtils.java b/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/BraveSafeBrowsingUtils.java index c09dba78d247..3327365f302a 100644 --- a/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/BraveSafeBrowsingUtils.java +++ b/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/BraveSafeBrowsingUtils.java @@ -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,