| 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/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProviderTest); | 104 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProviderTest); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 // TODO(crbug.com/682286): Flaky on windows 10. | 107 // TODO(crbug.com/682286): Flaky on windows 10. |
| 108 TEST_P(AntiVirusMetricsProviderTest, DISABLED_GetMetricsFullName) { | 108 TEST_P(AntiVirusMetricsProviderTest, DISABLED_GetMetricsFullName) { |
| 109 ASSERT_TRUE(thread_checker_.CalledOnValidThread()); | 109 ASSERT_TRUE(thread_checker_.CalledOnValidThread()); |
| 110 base::HistogramTester histograms; | 110 base::HistogramTester histograms; |
| 111 SetFullNamesFeatureEnabled(expect_unhashed_value_); | 111 SetFullNamesFeatureEnabled(expect_unhashed_value_); |
| 112 // Make sure the I/O is happening on the FILE thread by disallowing it on | 112 // Make sure the I/O is happening on a valid thread by disallowing it on the |
| 113 // the main thread. | 113 // main thread. |
| 114 bool previous_value = base::ThreadRestrictions::SetIOAllowed(false); | 114 bool previous_value = base::ThreadRestrictions::SetIOAllowed(false); |
| 115 provider_->GetAntiVirusMetrics( | 115 provider_->GetAntiVirusMetrics( |
| 116 base::Bind(&AntiVirusMetricsProviderTest::GetMetricsCallback, | 116 base::Bind(&AntiVirusMetricsProviderTest::GetMetricsCallback, |
| 117 weak_ptr_factory_.GetWeakPtr())); | 117 weak_ptr_factory_.GetWeakPtr())); |
| 118 scoped_task_environment_.RunUntilIdle(); | 118 scoped_task_environment_.RunUntilIdle(); |
| 119 EXPECT_TRUE(got_results_); | 119 EXPECT_TRUE(got_results_); |
| 120 base::ThreadRestrictions::SetIOAllowed(previous_value); | 120 base::ThreadRestrictions::SetIOAllowed(previous_value); |
| 121 | 121 |
| 122 AntiVirusMetricsProvider::ResultCode expected_result = | 122 AntiVirusMetricsProvider::ResultCode expected_result = |
| 123 AntiVirusMetricsProvider::RESULT_SUCCESS; | 123 AntiVirusMetricsProvider::RESULT_SUCCESS; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 145 {"Trustwave AV 3_0_2547", "Trustwave AV"}, | 145 {"Trustwave AV 3_0_2547", "Trustwave AV"}, |
| 146 {"nProtect Anti-Virus/Spyware V4.0", "nProtect Anti-Virus/Spyware"}, | 146 {"nProtect Anti-Virus/Spyware V4.0", "nProtect Anti-Virus/Spyware"}, |
| 147 {"ESET NOD32 Antivirus 9.0.349.15P", "ESET NOD32 Antivirus"}}; | 147 {"ESET NOD32 Antivirus 9.0.349.15P", "ESET NOD32 Antivirus"}}; |
| 148 | 148 |
| 149 for (const auto testcase : testcases) { | 149 for (const auto testcase : testcases) { |
| 150 auto output = | 150 auto output = |
| 151 AntiVirusMetricsProvider::TrimVersionOfAvProductName(testcase.input); | 151 AntiVirusMetricsProvider::TrimVersionOfAvProductName(testcase.input); |
| 152 EXPECT_STREQ(testcase.output, output.c_str()); | 152 EXPECT_STREQ(testcase.output, output.c_str()); |
| 153 } | 153 } |
| 154 } | 154 } |
| OLD | NEW |