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

Unified Diff: components/certificate_reporting/error_report_unittest.cc

Issue 2964283002: Add chrome channel to cert logger reports (Closed)
Patch Set: Clean up test comments Created 3 years, 6 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
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 03667c5b973ed262cbb8d99cb6095a1b4518336a..84f98be7cf32245064959c622b4973037fd63fb6 100644
--- a/components/certificate_reporting/error_report_unittest.cc
+++ b/components/certificate_reporting/error_report_unittest.cc
@@ -18,6 +18,7 @@
#include "components/certificate_reporting/cert_logger.pb.h"
#include "components/network_time/network_time_test_utils.h"
#include "components/prefs/testing_pref_service.h"
+#include "components/version_info/version_info.h"
#include "net/cert/cert_status_flags.h"
#include "net/ssl/ssl_info.h"
#include "net/test/cert_test_util.h"
@@ -247,6 +248,29 @@ TEST(ErrorReportTest, NetworkTimeQueryingFeatureInfo) {
.network_time_query_behavior());
}
+TEST(ErrorReportTest, TestChromeChannelIncluded) {
+ base::Thread io_thread("IO thread");
Lei Zhang 2017/06/30 22:32:06 Does your test case need an IO thread?
sperigo 2017/06/30 23:37:28 Done.
sperigo 2017/06/30 23:37:29 I guess not! Thanks.
+ base::Thread::Options thread_options;
+ thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
+ EXPECT_TRUE(io_thread.StartWithOptions(thread_options));
+
+ SSLInfo ssl_info;
+ ASSERT_NO_FATAL_FAILURE(
+ GetTestSSLInfo(INCLUDE_UNVERIFIED_CERT_CHAIN, &ssl_info, kCertStatus));
+ ErrorReport report(kDummyHostname, ssl_info);
+
+ // Add a chrome channel to the report.
+ report.AddChromeChannel(version_info::Channel::DEV);
+ std::string serialized_report;
+ ASSERT_TRUE(report.Serialize(&serialized_report));
+
+ // Check that the parsed report contains the chrome channel information.
+ CertLoggerRequest parsed;
+ ASSERT_TRUE(parsed.ParseFromString(serialized_report));
+ EXPECT_TRUE(parsed.chrome_channel());
Lei Zhang 2017/06/30 22:32:06 It is a bit weird to check chrome_channel() twice.
sperigo 2017/06/30 23:37:29 Done.
+ EXPECT_EQ(CertLoggerRequest::DEV, parsed.chrome_channel());
meacer 2017/06/30 22:24:46 A bit of an overkill but you might want to test al
sperigo 2017/06/30 23:37:29 Done.
sperigo 2017/06/30 23:37:29 I like this! I'm a fan of over testing over under
+}
+
#if defined(OS_ANDROID)
// Tests that information about the Android AIA fetching feature is included in
// the report.

Powered by Google App Engine
This is Rietveld 408576698