@@ -348,7 +348,7 @@ describeWithMockConnection('CrUXManager', () => {
348348 isPrimaryFrame : ( ) => false ,
349349 } as SDK . ResourceTreeModel . ResourceTreeFrame ) ;
350350
351- const result = await cruxManager . getFieldDataForCurrentPage ( ) ;
351+ const result = await cruxManager . getFieldDataForCurrentPageForTesting ( ) ;
352352
353353 assert . deepEqual ( result . warnings , [ ] ) ;
354354 assert . strictEqual ( getFieldDataMock . callCount , 1 ) ;
@@ -360,7 +360,7 @@ describeWithMockConnection('CrUXManager', () => {
360360 cruxManager . getConfigSetting ( ) . set (
361361 { enabled : false , override : 'https://example.com/override' , overrideEnabled : true } ) ;
362362
363- const result = await cruxManager . getFieldDataForCurrentPage ( ) ;
363+ const result = await cruxManager . getFieldDataForCurrentPageForTesting ( ) ;
364364
365365 assert . deepEqual ( result . warnings , [ 'Field data is configured for a different URL than the current page.' ] ) ;
366366 assert . strictEqual ( getFieldDataMock . callCount , 1 ) ;
@@ -377,7 +377,7 @@ describeWithMockConnection('CrUXManager', () => {
377377 } ] ,
378378 } ) ;
379379
380- const result = await cruxManager . getFieldDataForCurrentPage ( ) ;
380+ const result = await cruxManager . getFieldDataForCurrentPageForTesting ( ) ;
381381
382382 assert . deepEqual ( result . warnings , [ 'Field data is configured for a different URL than the current page.' ] ) ;
383383 assert . strictEqual ( getFieldDataMock . callCount , 1 ) ;
@@ -396,7 +396,7 @@ describeWithMockConnection('CrUXManager', () => {
396396 } ] ,
397397 } ) ;
398398
399- const result = await cruxManager . getFieldDataForCurrentPage ( ) ;
399+ const result = await cruxManager . getFieldDataForCurrentPageForTesting ( ) ;
400400
401401 assert . deepEqual ( result . warnings , [ 'Field data is configured for a different URL than the current page.' ] ) ;
402402 assert . strictEqual ( getFieldDataMock . callCount , 1 ) ;
@@ -406,7 +406,7 @@ describeWithMockConnection('CrUXManager', () => {
406406 it ( 'should use inspected URL if main document is unavailable' , async ( ) => {
407407 target . setInspectedURL ( urlString `https://example.com/inspected` ) ;
408408
409- const result = await cruxManager . getFieldDataForCurrentPage ( ) ;
409+ const result = await cruxManager . getFieldDataForCurrentPageForTesting ( ) ;
410410
411411 assert . deepEqual ( result . warnings , [ ] ) ;
412412 assert . strictEqual ( getFieldDataMock . callCount , 1 ) ;
@@ -416,7 +416,7 @@ describeWithMockConnection('CrUXManager', () => {
416416 it ( 'should wait for inspected URL if main document and inspected URL are unavailable' , async ( ) => {
417417 target . setInspectedURL ( Platform . DevToolsPath . EmptyUrlString ) ;
418418
419- const finishPromise = cruxManager . getFieldDataForCurrentPage ( ) ;
419+ const finishPromise = cruxManager . getFieldDataForCurrentPageForTesting ( ) ;
420420
421421 await triggerMicroTaskQueue ( ) ;
422422
@@ -430,7 +430,8 @@ describeWithMockConnection('CrUXManager', () => {
430430 } ) ;
431431
432432 it ( 'getSelectedFieldMetricData - should take from selected page scope' , async ( ) => {
433- await cruxManager . getFieldDataForCurrentPage ( ) ;
433+ cruxManager . getConfigSetting ( ) . set ( { enabled : true } ) ;
434+ await cruxManager . refresh ( ) ;
434435
435436 let data : CrUXManager . MetricResponse | undefined ;
436437
@@ -448,7 +449,8 @@ describeWithMockConnection('CrUXManager', () => {
448449 } ) ;
449450
450451 it ( 'should take from selected device scope' , async ( ) => {
451- await cruxManager . getFieldDataForCurrentPage ( ) ;
452+ cruxManager . getConfigSetting ( ) . set ( { enabled : true } ) ;
453+ await cruxManager . refresh ( ) ;
452454 cruxManager . fieldPageScope = 'url' ;
453455
454456 let data : CrUXManager . MetricResponse | undefined ;
@@ -470,7 +472,8 @@ describeWithMockConnection('CrUXManager', () => {
470472 cruxManager . fieldDeviceOption = 'AUTO' ;
471473 assert . strictEqual ( cruxManager . getSelectedDeviceScope ( ) , 'ALL' ) ;
472474
473- await cruxManager . getFieldDataForCurrentPage ( ) ;
475+ cruxManager . getConfigSetting ( ) . set ( { enabled : true } ) ;
476+ await cruxManager . refresh ( ) ;
474477 assert . strictEqual ( cruxManager . getSelectedDeviceScope ( ) , 'DESKTOP' ) ;
475478
476479 for ( const device of EmulationModel . EmulatedDevices . EmulatedDevicesList . instance ( ) . standard ( ) ) {
@@ -493,7 +496,7 @@ describeWithMockConnection('CrUXManager', () => {
493496 cruxManager . addEventListener ( CrUXManager . Events . FIELD_DATA_CHANGED , event => {
494497 eventBodies . push ( event . data ) ;
495498 } ) ;
496- getFieldDataMock = sinon . stub ( cruxManager , 'getFieldDataForCurrentPage ' ) ;
499+ getFieldDataMock = sinon . stub ( cruxManager , 'getFieldDataForPage ' ) ;
497500 getFieldDataMock . resolves ( {
498501 'origin-ALL' : null ,
499502 'origin-DESKTOP' : null ,
@@ -503,6 +506,7 @@ describeWithMockConnection('CrUXManager', () => {
503506 'url-DESKTOP' : null ,
504507 'url-PHONE' : null ,
505508 'url-TABLET' : null ,
509+ warnings : [ ] ,
506510 } ) ;
507511 } ) ;
508512
0 commit comments