| Index: components/certificate_reporting/error_report_unittest.cc
|
| diff --git a/components/certificate_reporting/error_report_unittest.cc b/components/certificate_reporting/error_report_unittest.cc
|
| index c49b5448a5365ddbf56d91749c003edcd4c5ac48..03a314c66b544ff909556be08514ca439754d50c 100644
|
| --- a/components/certificate_reporting/error_report_unittest.cc
|
| +++ b/components/certificate_reporting/error_report_unittest.cc
|
| @@ -178,6 +178,36 @@ TEST(ErrorReportTest, CertificateTransparencyError) {
|
| VerifyErrorReportSerialization(report_known, ssl_info, cert_errors));
|
| }
|
|
|
| +// Tests that information about relevant features are included in the
|
| +// report.
|
| +TEST(ErrorReportTest, FeatureInfo) {
|
| + const std::string kFeatureName = "TestFeature";
|
| + std::map<std::string, std::string> params;
|
| + params["foo"] = "bar";
|
| + params["foo2"] = "bar2";
|
| +
|
| + // Serialize a report containing information about the test feature.
|
| + SSLInfo ssl_info;
|
| + ASSERT_NO_FATAL_FAILURE(
|
| + GetTestSSLInfo(INCLUDE_UNVERIFIED_CERT_CHAIN, &ssl_info, kCertStatus));
|
| + ErrorReport report(kDummyHostname, ssl_info);
|
| + report.AddFeature(kFeatureName, true, params);
|
| + std::string serialized_report;
|
| + ASSERT_TRUE(report.Serialize(&serialized_report));
|
| +
|
| + // Check that the report contains the test feature information.
|
| + CertLoggerRequest parsed;
|
| + ASSERT_TRUE(parsed.ParseFromString(serialized_report));
|
| + ASSERT_EQ(1, parsed.features_info().size());
|
| + EXPECT_EQ(kFeatureName, parsed.features_info(0).feature());
|
| + EXPECT_TRUE(parsed.features_info(0).enabled());
|
| + std::map<std::string, std::string> parsed_params;
|
| + for (const auto& param : parsed.features_info(0).params()) {
|
| + parsed_params[param.name()] = param.value();
|
| + }
|
| + EXPECT_EQ(params, parsed_params);
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace certificate_reporting
|
|
|