@@ -97,7 +97,7 @@ describeWithEnvironment('TimelinePanel', function() {
9797 const tracksAfterEnablingSetting = timeline . getFlameChart ( ) . getMainDataProvider ( ) . timelineData ( ) . groups ;
9898 assert . deepEqual ( tracksBeforeDisablingSetting , tracksAfterEnablingSetting ) ;
9999 } ) ;
100- it ( 'should keep overlays when the custom tracks setting is toggled' , async function ( ) {
100+ it ( 'should keep marker overlays when the custom tracks setting is toggled' , async function ( ) {
101101 const events = await TraceLoader . rawEvents ( this , 'web-dev.json.gz' ) as Trace . Types . Events . Event [ ] ;
102102 await timeline . loadingComplete ( events , null , null ) ;
103103 const overlaysBeforeDisablingSetting = timeline . getFlameChart ( ) . overlays ( ) . allOverlays ( ) ;
@@ -137,4 +137,33 @@ describeWithEnvironment('TimelinePanel', function() {
137137 assert . exists ( dimIndicesAfterToggle ) ;
138138 assert . isAbove ( dimIndicesAfterToggle . length , 0 ) ;
139139 } ) ;
140+
141+ it ( 'keeps annotations after toggling the custom tracks setting' , async function ( ) {
142+ const events = await TraceLoader . rawEvents ( this , 'web-dev.json.gz' ) as Trace . Types . Events . Event [ ] ;
143+ await timeline . loadingComplete ( events , null , null ) ;
144+ const parsedTrace = traceModel . parsedTrace ( ) ;
145+ assert . isOk ( parsedTrace ?. Meta . traceBounds . min ) ;
146+ const modificationsManager = Timeline . ModificationsManager . ModificationsManager . activeManager ( ) ;
147+ assert . isOk ( modificationsManager ) ;
148+
149+ // Add an annotation
150+ modificationsManager . createAnnotation ( {
151+ bounds : Trace . Helpers . Timing . traceWindowFromMicroSeconds (
152+ parsedTrace . Meta . traceBounds . min , parsedTrace . Meta . traceBounds . max ) ,
153+ type : 'TIME_RANGE' ,
154+ label : '' ,
155+ } ) ;
156+
157+ const annotationsBeforeToggle =
158+ timeline . getFlameChart ( ) . overlays ( ) . allOverlays ( ) . filter ( e => e . type === 'TIME_RANGE' ) ;
159+ assert . exists ( annotationsBeforeToggle ) ;
160+ assert . isAbove ( annotationsBeforeToggle . length , 0 ) ;
161+
162+ // Toggle the custom track setting and verify annotations remain.
163+ Timeline . TimelinePanel . TimelinePanel . extensionDataVisibilitySetting ( ) . set ( true ) ;
164+ const annotationsAfterToggle =
165+ timeline . getFlameChart ( ) . overlays ( ) . allOverlays ( ) . filter ( e => e . type === 'TIME_RANGE' ) ;
166+ assert . exists ( annotationsAfterToggle ) ;
167+ assert . isAbove ( annotationsAfterToggle . length , 0 ) ;
168+ } ) ;
140169} ) ;
0 commit comments