@@ -14,7 +14,7 @@ import {
14
14
} from '../fixtures/profiles/processed-profile' ;
15
15
import { markerSchemaForTests } from '../fixtures/profiles/marker-schema' ;
16
16
import { ensureExists } from 'firefox-profiler/utils/flow' ;
17
-
17
+ import { getTimeRangeIncludingAllThreads } from 'firefox-profiler/profile-logic/profile-data' ;
18
18
import type { Thread } from 'firefox-profiler/types' ;
19
19
20
20
describe ( 'mergeProfilesForDiffing function' , function ( ) {
@@ -233,6 +233,38 @@ describe('mergeProfilesForDiffing function', function () {
233
233
expect ( mergedProfileThreadB . nativeSymbols . libIndex ) . toEqual ( [ 1 , 1 ] ) ;
234
234
expect ( mergedThread . nativeSymbols . libIndex ) . toEqual ( [ 0 , 0 , 1 , 1 ] ) ;
235
235
} ) ;
236
+
237
+ it ( 'should use marker timing if there are no samples' , ( ) => {
238
+ const profiles = [
239
+ getProfileWithMarkers ( [
240
+ [ 'Thread1 Marker1' , 2 ] ,
241
+ [ 'Thread1 Marker2' , 3 , 5 ] ,
242
+ [ 'Thread1 Marker3' , 6 , 7 ] ,
243
+ ] ) ,
244
+
245
+ getProfileWithMarkers ( [
246
+ [ 'Thread1 Marker1' , 5 ] ,
247
+ [ 'Thread1 Marker2' , 6 , 8 ] ,
248
+ [ 'Thread1 Marker3' , 10 , 15 ] ,
249
+ ] ) ,
250
+ ] ;
251
+
252
+ const profileState = stateFromLocation ( {
253
+ pathname : '/public/fakehash1/' ,
254
+ search : '?thread=0&v=3' ,
255
+ hash : '' ,
256
+ } ) ;
257
+
258
+ const { profile } = mergeProfilesForDiffing ( profiles , [
259
+ profileState ,
260
+ profileState ,
261
+ ] ) ;
262
+
263
+ expect ( getTimeRangeIncludingAllThreads ( profile ) ) . toEqual ( {
264
+ start : 0 ,
265
+ end : 11 ,
266
+ } ) ;
267
+ } ) ;
236
268
} ) ;
237
269
238
270
describe ( 'mergeThreads function' , function ( ) {
0 commit comments