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

Unified Diff: components/browser_watcher/postmortem_report_collector_unittest.cc

Issue 2691033002: Collect field trial information from the stability file (Closed)
Patch Set: Address rkaplow's comments Created 3 years, 10 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/browser_watcher/postmortem_report_collector_unittest.cc
diff --git a/components/browser_watcher/postmortem_report_collector_unittest.cc b/components/browser_watcher/postmortem_report_collector_unittest.cc
index 8d8d5cc4130ef63909db4349b724924b4388888d..ae241e37a5d4ab882d00f94882933a0ab6779318 100644
--- a/components/browser_watcher/postmortem_report_collector_unittest.cc
+++ b/components/browser_watcher/postmortem_report_collector_unittest.cc
@@ -650,6 +650,38 @@ TEST_F(PostmortemReportCollectorCollectionFromGlobalTrackerTest,
}
TEST_F(PostmortemReportCollectorCollectionFromGlobalTrackerTest,
+ FieldTrialCollection) {
+ // Record some data.
+ GlobalActivityTracker::CreateWithFile(debug_file_path(), kMemorySize, 0ULL,
+ "", 3);
+ ActivityUserData& global_data = GlobalActivityTracker::Get()->global_data();
+ global_data.SetString("string", "bar");
+ global_data.SetString("FieldTrial.string", "bar");
+ global_data.SetString("FieldTrial.foo", "bar");
+
+ // Collect the stability report.
+ PostmortemReportCollector collector(kProductName, kVersionNumber,
+ kChannelName);
+ std::unique_ptr<StabilityReport> report;
+ ASSERT_EQ(PostmortemReportCollector::SUCCESS,
+ collector.Collect(debug_file_path(), &report));
+ ASSERT_NE(nullptr, report);
+
+ // Validate the report's experiment and global data.
+ ASSERT_EQ(2, report->field_trials_size());
+ EXPECT_NE(0U, report->field_trials(0).name_id());
+ EXPECT_NE(0U, report->field_trials(0).group_id());
+ EXPECT_NE(0U, report->field_trials(1).name_id());
+ EXPECT_EQ(report->field_trials(0).group_id(),
+ report->field_trials(1).group_id());
+
+ // Expect 5 key/value pairs (including product details).
+ const auto& collected_data = report->global_data();
+ EXPECT_EQ(5U, collected_data.size());
+ EXPECT_TRUE(base::ContainsKey(collected_data, "string"));
+}
+
+TEST_F(PostmortemReportCollectorCollectionFromGlobalTrackerTest,
ModuleCollection) {
// Record some module information.
GlobalActivityTracker::CreateWithFile(debug_file_path(), kMemorySize, 0ULL,
« no previous file with comments | « components/browser_watcher/postmortem_report_collector.cc ('k') | components/browser_watcher/stability_report.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698