| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/metrics/antivirus_metrics_provider_win.h" | 5 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 content::TestBrowserThreadBundle thread_bundle_; | 106 content::TestBrowserThreadBundle thread_bundle_; |
| 107 base::test::ScopedFeatureList scoped_feature_list_; | 107 base::test::ScopedFeatureList scoped_feature_list_; |
| 108 base::RunLoop run_loop_; | 108 base::RunLoop run_loop_; |
| 109 base::ThreadChecker thread_checker_; | 109 base::ThreadChecker thread_checker_; |
| 110 base::WeakPtrFactory<AntiVirusMetricsProviderTest> weak_ptr_factory_; | 110 base::WeakPtrFactory<AntiVirusMetricsProviderTest> weak_ptr_factory_; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProviderTest); | 113 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProviderTest); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 TEST_P(AntiVirusMetricsProviderTest, GetMetricsFullName) { | 116 // TODO(crbug.com/682286): Flaky on windows 10. |
| 117 TEST_P(AntiVirusMetricsProviderTest, DISABLED_GetMetricsFullName) { |
| 117 ASSERT_TRUE(thread_checker_.CalledOnValidThread()); | 118 ASSERT_TRUE(thread_checker_.CalledOnValidThread()); |
| 118 base::HistogramTester histograms; | 119 base::HistogramTester histograms; |
| 119 SetFullNamesFeatureEnabled(expect_unhashed_value_); | 120 SetFullNamesFeatureEnabled(expect_unhashed_value_); |
| 120 // Make sure the I/O is happening on the FILE thread by disallowing it on | 121 // Make sure the I/O is happening on the FILE thread by disallowing it on |
| 121 // the main thread. | 122 // the main thread. |
| 122 bool previous_value = base::ThreadRestrictions::SetIOAllowed(false); | 123 bool previous_value = base::ThreadRestrictions::SetIOAllowed(false); |
| 123 provider_->GetAntiVirusMetrics( | 124 provider_->GetAntiVirusMetrics( |
| 124 base::Bind(&AntiVirusMetricsProviderTest::GetMetricsCallback, | 125 base::Bind(&AntiVirusMetricsProviderTest::GetMetricsCallback, |
| 125 weak_ptr_factory_.GetWeakPtr())); | 126 weak_ptr_factory_.GetWeakPtr())); |
| 126 content::RunThisRunLoop(&run_loop_); | 127 content::RunThisRunLoop(&run_loop_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 153 {"Trustwave AV 3_0_2547", "Trustwave AV"}, | 154 {"Trustwave AV 3_0_2547", "Trustwave AV"}, |
| 154 {"nProtect Anti-Virus/Spyware V4.0", "nProtect Anti-Virus/Spyware"}, | 155 {"nProtect Anti-Virus/Spyware V4.0", "nProtect Anti-Virus/Spyware"}, |
| 155 {"ESET NOD32 Antivirus 9.0.349.15P", "ESET NOD32 Antivirus"}}; | 156 {"ESET NOD32 Antivirus 9.0.349.15P", "ESET NOD32 Antivirus"}}; |
| 156 | 157 |
| 157 for (const auto testcase : testcases) { | 158 for (const auto testcase : testcases) { |
| 158 auto output = | 159 auto output = |
| 159 AntiVirusMetricsProvider::TrimVersionOfAvProductName(testcase.input); | 160 AntiVirusMetricsProvider::TrimVersionOfAvProductName(testcase.input); |
| 160 EXPECT_STREQ(testcase.output, output.c_str()); | 161 EXPECT_STREQ(testcase.output, output.c_str()); |
| 161 } | 162 } |
| 162 } | 163 } |
| OLD | NEW |