@@ -126,6 +126,45 @@ class AnalyticsManagerTest with ResourceProviderMixin {
126126 PluginManager .pluginResponseTimes.clear ();
127127 }
128128
129+ Future <void > test_server_contextStructure () async {
130+ _defaultStartup ();
131+
132+ // Record a brief working period.
133+ manager.analysisComplete (
134+ immediateFileCount: 1 ,
135+ immediateFileLineCount: 1 ,
136+ transitiveFileCount: 3 ,
137+ transitiveFileLineCount: 20 ,
138+ transitiveFileUniqueCount: 2 ,
139+ transitiveFileUniqueLineCount: 15 ,
140+ libraryCycleLibraryCounts: [],
141+ libraryCycleLineCounts: [],
142+ numberOfContexts: 3 ,
143+ contextWorkspaceType: [0 , 1 , 2 ],
144+ numberOfPackagesInWorkspace: [1 , 3 , 4 ],
145+ );
146+
147+ await manager.shutdown ();
148+ analytics.assertEvents ([
149+ _ExpectedEvent .session (),
150+ _ExpectedEvent .contextStructure (
151+ eventData: {
152+ 'immediateFileCount' : 1 ,
153+ 'immediateFileLineCount' : 1 ,
154+ 'transitiveFileCount' : 3 ,
155+ 'transitiveFileLineCount' : 20 ,
156+ 'transitiveFileUniqueCount' : 2 ,
157+ 'transitiveFileUniqueLineCount' : 15 ,
158+ 'libraryCycleLibraryCounts' : _IsPercentiles (),
159+ 'libraryCycleLineCounts' : _IsPercentiles (),
160+ 'numberOfContexts' : 3 ,
161+ 'contextWorkspaceType' : '[0, 1, 2]' ,
162+ 'numberOfPackagesInWorkspace' : _IsPercentiles (),
163+ },
164+ ),
165+ ]);
166+ }
167+
129168 Future <void > test_server_notification () async {
130169 _defaultStartup ();
131170 manager.handledNotificationMessage (
@@ -539,6 +578,9 @@ class _ExpectedEvent {
539578 _ExpectedEvent .commandExecuted ({Map <String , Object ?>? eventData})
540579 : this (DashEvent .commandExecuted, eventData);
541580
581+ _ExpectedEvent .contextStructure ({Map <String , Object ?>? eventData})
582+ : this (DashEvent .contextStructure, eventData);
583+
542584 _ExpectedEvent .lintUsageCount ({Map <String , Object ?>? eventData})
543585 : this (DashEvent .lintUsageCount, eventData);
544586
0 commit comments