Index: chrome/browser/ssl/certificate_reporting_test_utils.cc |
diff --git a/chrome/browser/ssl/certificate_reporting_test_utils.cc b/chrome/browser/ssl/certificate_reporting_test_utils.cc |
index 433694b444b54f0229254136c0437a076ca1f0e5..06e7dd2bf6e4c928426affdb704c512b91ba3cf6 100644 |
--- a/chrome/browser/ssl/certificate_reporting_test_utils.cc |
+++ b/chrome/browser/ssl/certificate_reporting_test_utils.cc |
@@ -9,6 +9,7 @@ |
#include "base/metrics/field_trial.h" |
#include "base/prefs/pref_service.h" |
#include "base/run_loop.h" |
+#include "base/strings/string_number_conversions.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/safe_browsing/ping_manager.h" |
@@ -100,7 +101,7 @@ void CertificateReportingTest::SetUpMockReporter() { |
base::Passed(scoped_ptr<CertificateErrorReporter>(reporter_)))); |
} |
-const std::string& CertificateReportingTest::GetLatestHostnameReported() { |
+const std::string& CertificateReportingTest::GetLatestHostnameReported() const { |
return reporter_->latest_hostname_reported(); |
} |
@@ -163,22 +164,22 @@ scoped_ptr<SSLCertReporter> SetUpMockSSLCertReporter( |
return ssl_cert_reporter.Pass(); |
} |
-// Helper function to set the Finch options. |
-void SetCertReportingFinchConfig(const std::string& group_name, |
- const std::string& param_value) { |
- base::FieldTrialList::CreateFieldTrial(CertReportHelper::kFinchExperimentName, |
- group_name); |
- if (!param_value.empty()) { |
- std::map<std::string, std::string> params; |
- params[CertReportHelper::kFinchParamName] = param_value; |
- variations::AssociateVariationParams(CertReportHelper::kFinchExperimentName, |
- group_name, params); |
- } |
-} |
+ExpectReport GetReportExpectedFromFinch() { |
+ const std::string group_name = base::FieldTrialList::FindFullName( |
+ CertReportHelper::kFinchExperimentName); |
-// Helper function to set the Finch options in case we have no parameter. |
-void SetCertReportingFinchConfig(const std::string& group_name) { |
- SetCertReportingFinchConfig(group_name, std::string()); |
+ if (group_name == CertReportHelper::kFinchGroupShowPossiblySend) { |
+ const std::string param = variations::GetVariationParamValue( |
+ CertReportHelper::kFinchExperimentName, |
+ CertReportHelper::kFinchParamName); |
+ double sendingThreshold; |
+ if (!base::StringToDouble(param, &sendingThreshold)) |
+ return CERT_REPORT_NOT_EXPECTED; |
+ |
+ if (sendingThreshold == 1.0) |
+ return CertificateReportingTestUtils::CERT_REPORT_EXPECTED; |
+ } |
+ return CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED; |
} |
} // namespace CertificateReportingTestUtils |