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

Unified Diff: chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc

Issue 2631583002: Trim version and extraneus parts from AntiVirus product names. (Closed)
Patch Set: remove unneeded code Created 3 years, 11 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
« no previous file with comments | « chrome/browser/metrics/antivirus_metrics_provider_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
diff --git a/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc b/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
index 9ace612832c8d1ca98d1bc1fe795b1f65ff3b023..6bd0f5a6d73c3102f716b820c08aecbee8f822e7 100644
--- a/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
+++ b/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
@@ -25,6 +25,11 @@
namespace {
+struct Testcase {
+ const char* input;
+ const char* output;
+};
+
void VerifySystemProfileData(const metrics::SystemProfileProto& system_profile,
bool expect_unhashed_value) {
const char kWindowsDefender[] = "Windows Defender";
@@ -49,6 +54,8 @@ void VerifySystemProfileData(const metrics::SystemProfileProto& system_profile,
} // namespace
+class AntiVirusMetricsProviderSimpleTest : public ::testing::Test {};
+
class AntiVirusMetricsProviderTest : public ::testing::TestWithParam<bool> {
public:
AntiVirusMetricsProviderTest()
@@ -130,3 +137,26 @@ TEST_P(AntiVirusMetricsProviderTest, GetMetricsFullName) {
}
INSTANTIATE_TEST_CASE_P(, AntiVirusMetricsProviderTest, ::testing::Bool());
+
+TEST_F(AntiVirusMetricsProviderSimpleTest, StripProductVersion) {
+ Testcase testcases[] = {
+ {"", ""},
+ {" ", ""},
+ {"1.0 AV 2.0", "1.0 AV"},
+ {"Anti Virus", "Anti Virus"},
+ {"Windows Defender", "Windows Defender"},
+ {"McAfee AntiVirus has a space at the end ",
+ "McAfee AntiVirus has a space at the end"},
+ {"ESET NOD32 Antivirus 8.0", "ESET NOD32 Antivirus"},
+ {"Norton 360", "Norton 360"},
+ {"ESET Smart Security 9.0.381.1", "ESET Smart Security"},
+ {"Trustwave AV 3_0_2547", "Trustwave AV"},
+ {"nProtect Anti-Virus/Spyware V4.0", "nProtect Anti-Virus/Spyware"},
+ {"ESET NOD32 Antivirus 9.0.349.15P", "ESET NOD32 Antivirus"}};
+
+ for (const auto testcase : testcases) {
+ auto output =
+ AntiVirusMetricsProvider::TrimVersionOfAvProductName(testcase.input);
+ EXPECT_STREQ(testcase.output, output.c_str());
+ }
+}
« no previous file with comments | « chrome/browser/metrics/antivirus_metrics_provider_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698