5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- #include < folly/Format .h>
8
+ #include < fmt/format .h>
9
9
#include < folly/dynamic.h>
10
10
#include < folly/executors/ManualExecutor.h>
11
11
#include < folly/executors/QueuedImmediateExecutor.h>
16
16
#include < jsinspector-modern/InspectorInterfaces.h>
17
17
#include < jsinspector-modern/InspectorPackagerConnection.h>
18
18
19
- #include < format>
20
19
#include < memory>
21
20
22
21
#include " FollyDynamicMatchers.h"
@@ -282,7 +281,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEvents) {
282
281
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
283
282
284
283
// Connect to the page.
285
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
284
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
286
285
R"( {{
287
286
"event": "connect",
288
287
"payload": {{
@@ -322,7 +321,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEvents) {
322
321
AtJsonPtr (" /params" , ElementsAre (" arg1" , " arg2" ))))))
323
322
.RetiresOnSaturation ();
324
323
325
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
324
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
326
325
R"( {{
327
326
"event": "wrappedEvent",
328
327
"payload": {{
@@ -374,7 +373,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEventsToMultiplePages) {
374
373
375
374
for (int i = 0 ; i < kNumPages ; ++i) {
376
375
// Connect to the i-th page.
377
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
376
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
378
377
R"( {{
379
378
"event": "connect",
380
379
"payload": {{
@@ -416,7 +415,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEventsToMultiplePages) {
416
415
*localConnections_[i],
417
416
sendMessage (JsonParsed (AtJsonPtr (" /method" , Eq (method)))))
418
417
.RetiresOnSaturation ();
419
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
418
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
420
419
R"( {{
421
420
"event": "wrappedEvent",
422
421
"payload": {{
@@ -446,7 +445,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendEventToAllConnections) {
446
445
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
447
446
448
447
// Connect to the page.
449
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
448
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
450
449
R"( {{
451
450
"event": "connect",
452
451
"payload": {{
@@ -487,7 +486,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenDisconnect) {
487
486
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
488
487
489
488
// Connect to the page.
490
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
489
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
491
490
R"( {{
492
491
"event": "connect",
493
492
"payload": {{
@@ -499,7 +498,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenDisconnect) {
499
498
500
499
// Disconnect from the page.
501
500
EXPECT_CALL (*localConnections_[0 ], disconnect ()).RetiresOnSaturation ();
502
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
501
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
503
502
R"( {{
504
503
"event": "disconnect",
505
504
"payload": {{
@@ -522,7 +521,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenCloseSocket) {
522
521
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
523
522
524
523
// Connect to the page.
525
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
524
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
526
525
R"( {{
527
526
"event": "connect",
528
527
"payload": {{
@@ -550,7 +549,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenSocketFailure) {
550
549
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
551
550
552
551
// Connect to the page.
553
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
552
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
554
553
R"( {{
555
554
"event": "connect",
556
555
"payload": {{
@@ -580,7 +579,7 @@ TEST_F(
580
579
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
581
580
582
581
// Connect to the page.
583
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
582
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
584
583
R"( {{
585
584
"event": "connect",
586
585
"payload": {{
@@ -626,7 +625,7 @@ TEST_F(
626
625
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
627
626
628
627
// Connect to the page.
629
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
628
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
630
629
R"( {{
631
630
"event": "connect",
632
631
"payload": {{
@@ -638,7 +637,7 @@ TEST_F(
638
637
639
638
// Try connecting to the same page again. This results in a disconnection.
640
639
EXPECT_CALL (*localConnections_[0 ], disconnect ()).RetiresOnSaturation ();
641
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
640
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
642
641
R"( {{
643
642
"event": "connect",
644
643
"payload": {{
@@ -661,7 +660,7 @@ TEST_F(InspectorPackagerConnectionTest, TestMultipleDisconnect) {
661
660
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
662
661
663
662
// Connect to the page.
664
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
663
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
665
664
R"( {{
666
665
"event": "connect",
667
666
"payload": {{
@@ -673,7 +672,7 @@ TEST_F(InspectorPackagerConnectionTest, TestMultipleDisconnect) {
673
672
674
673
// Disconnect from the page.
675
674
EXPECT_CALL (*localConnections_[0 ], disconnect ()).RetiresOnSaturation ();
676
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
675
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
677
676
R"( {{
678
677
"event": "disconnect",
679
678
"payload": {{
@@ -684,7 +683,7 @@ TEST_F(InspectorPackagerConnectionTest, TestMultipleDisconnect) {
684
683
EXPECT_FALSE (localConnections_[0 ]);
685
684
686
685
// Disconnect again. This is a noop.
687
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
686
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
688
687
R"( {{
689
688
"event": "disconnect",
690
689
"payload": {{
@@ -707,7 +706,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDisconnectThenSendEvent) {
707
706
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
708
707
709
708
// Connect to the page.
710
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
709
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
711
710
R"( {{
712
711
"event": "connect",
713
712
"payload": {{
@@ -719,7 +718,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDisconnectThenSendEvent) {
719
718
720
719
// Disconnect from the page.
721
720
EXPECT_CALL (*localConnections_[0 ], disconnect ()).RetiresOnSaturation ();
722
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
721
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
723
722
R"( {{
724
723
"event": "disconnect",
725
724
"payload": {{
@@ -731,7 +730,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDisconnectThenSendEvent) {
731
730
732
731
// Send an event from the frontend (remote) to the backend (local). This
733
732
// is a noop.
734
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
733
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
735
734
R"( {{
736
735
"event": "wrappedEvent",
737
736
"payload": {{
@@ -755,7 +754,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendEventToUnknownPage) {
755
754
756
755
// Send an event from the frontend (remote) to the backend (local). This
757
756
// is a noop (except for logging).
758
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
757
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
759
758
R"( {{
760
759
"event": "wrappedEvent",
761
760
"payload": {{
@@ -922,7 +921,7 @@ TEST_F(
922
921
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
923
922
924
923
// Connect to the page.
925
- retainedWebSocketDelegate->didReceiveMessage (std ::format (
924
+ retainedWebSocketDelegate->didReceiveMessage (fmt ::format (
926
925
R"( {{
927
926
"event": "connect",
928
927
"payload": {{
@@ -942,7 +941,7 @@ TEST_F(
942
941
AtJsonPtr (" /params" , ElementsAre (" arg1" , " arg2" ))))))
943
942
.RetiresOnSaturation ();
944
943
945
- retainedWebSocketDelegate->didReceiveMessage (std ::format (
944
+ retainedWebSocketDelegate->didReceiveMessage (fmt ::format (
946
945
R"( {{
947
946
"event": "wrappedEvent",
948
947
"payload": {{
@@ -976,7 +975,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDestroyConnectionOnPageRemoved) {
976
975
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
977
976
978
977
// Connect to the page.
979
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
978
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
980
979
R"( {{
981
980
"event": "connect",
982
981
"payload": {{
@@ -1006,7 +1005,7 @@ TEST_F(
1006
1005
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
1007
1006
1008
1007
// Connect to the page.
1009
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1008
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1010
1009
R"( {{
1011
1010
"event": "connect",
1012
1011
"payload": {{
@@ -1046,7 +1045,7 @@ TEST_F(
1046
1045
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
1047
1046
1048
1047
// Connect to the page.
1049
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1048
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1050
1049
R"( {{
1051
1050
"event": "connect",
1052
1051
"payload": {{
@@ -1065,7 +1064,7 @@ TEST_F(
1065
1064
1066
1065
// Disconnect from the page.
1067
1066
EXPECT_CALL (*localConnections_[0 ], disconnect ()).RetiresOnSaturation ();
1068
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1067
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1069
1068
R"( {{
1070
1069
"event": "disconnect",
1071
1070
"payload": {{
@@ -1076,7 +1075,7 @@ TEST_F(
1076
1075
EXPECT_FALSE (localConnections_[0 ]);
1077
1076
1078
1077
// Connect to the same page again.
1079
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1078
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1080
1079
R"( {{
1081
1080
"event": "connect",
1082
1081
"payload": {{
@@ -1128,7 +1127,7 @@ TEST_F(
1128
1127
.lazily_make_unique <std::unique_ptr<IRemoteConnection>>());
1129
1128
1130
1129
// Connect to the page.
1131
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1130
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1132
1131
R"( {{
1133
1132
"event": "connect",
1134
1133
"payload": {{
@@ -1152,7 +1151,7 @@ TEST_F(
1152
1151
1153
1152
// Disconnect from the page.
1154
1153
EXPECT_CALL (*localConnections_[0 ], disconnect ()).RetiresOnSaturation ();
1155
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1154
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1156
1155
R"( {{
1157
1156
"event": "disconnect",
1158
1157
"payload": {{
@@ -1163,7 +1162,7 @@ TEST_F(
1163
1162
EXPECT_FALSE (localConnections_[0 ]);
1164
1163
1165
1164
// Connect to the same page again.
1166
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1165
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1167
1166
R"( {{
1168
1167
"event": "connect",
1169
1168
"payload": {{
@@ -1257,7 +1256,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) {
1257
1256
AtJsonPtr (" /payload/pageId" , Eq (std::to_string (pageId)))))))
1258
1257
.RetiresOnSaturation ();
1259
1258
1260
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1259
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1261
1260
R"( {{
1262
1261
"event": "connect",
1263
1262
"payload": {{
@@ -1266,7 +1265,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) {
1266
1265
}})" ,
1267
1266
toJson (std::to_string (pageId))));
1268
1267
1269
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1268
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1270
1269
R"( {{
1271
1270
"event": "wrappedEvent",
1272
1271
"payload": {{
@@ -1292,7 +1291,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) {
1292
1291
AtJsonPtr (" /payload/pageId" , Eq (std::to_string (pageId)))))))
1293
1292
.RetiresOnSaturation ();
1294
1293
1295
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1294
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1296
1295
R"( {{
1297
1296
"event": "connect",
1298
1297
"payload": {{
@@ -1301,7 +1300,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) {
1301
1300
}})" ,
1302
1301
toJson (std::to_string (pageId))));
1303
1302
1304
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1303
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1305
1304
R"( {{
1306
1305
"event": "wrappedEvent",
1307
1306
"payload": {{
@@ -1320,7 +1319,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) {
1320
1319
// page.
1321
1320
mockNextConnectionBehavior = Accept;
1322
1321
1323
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1322
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1324
1323
R"( {{
1325
1324
"event": "connect",
1326
1325
"payload": {{
@@ -1337,7 +1336,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) {
1337
1336
AtJsonPtr (" /params" , ElementsAre (" arg1" , " arg2" ))))))
1338
1337
.RetiresOnSaturation ();
1339
1338
1340
- webSockets_[0 ]->getDelegate ().didReceiveMessage (std ::format (
1339
+ webSockets_[0 ]->getDelegate ().didReceiveMessage (fmt ::format (
1341
1340
R"( {{
1342
1341
"event": "wrappedEvent",
1343
1342
"payload": {{
0 commit comments