1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340
  341
  342
  343
  344
  345
  346
  347
  348
  349
  350
  351
  352
  353
  354
  355
  356
  357
  358
  359
  360
  361
  362
  363
  364
  365
  366
  367
  368
  369
  370
  371
  372
  373
  374
  375
  376
  377
  378
  379
  380
  381
  382
  383
  384
  385
  386
  387
  388
  389
  390
  391
  392
  393
  394
  395
  396
  397
  398
  399
  400
  401
  402
  403
  404
  405
  406
  407
  408
  409
  410
  411
  412
  413
  414
  415
  416
  417
  418
  419
  420
  421
  422
  423
  424
  425
  426
  427
  428
  429
  430
  431
  432
  433
  434
  435
  436
  437
  438
  439
  440
  441
  442
  443
  444
  445
  446
  447
  448
  449
  450
  451
  452
  453
  454
  455
  456
  457
  458
  459
  460
  461
  462
  463
  464
  465
  466
  467
  468
  469
  470
  471
  472
  473
  474
  475
  476
  477
  478
  479
  480
  481
  482
  483
  484
  485
  486
  487
  488
  489
  490
  491
  492
  493
  494
  495
  496
  497
  498
  499
  500
  501
  502
  503
  504
  505
  506
  507
  508
  509
  510
  511
  512
  513
  514
  515
  516
  517
  518
  519
  520
  521
  522
  523
  524
  525
  526
  527
  528
  529
  530
  531
  532
  533
  534
  535
  536
  537
  538
  539
  540
  541
  542
  543
  544
  545
  546
  547
  548
  549
  550
  551
  552
  553
  554
  555
  556
  557
  558
  559
  560
  561
  562
  563
  564
  565
  566
  567
  568
  569
  570
  571
  572
  573
  574
  575
  576
  577
  578
  579
  580
  581
  582
  583
  584
  585
  586
  587
  588
  589
  590
  591
  592
  593
  594
  595
  596
  597
  598
  599
  600
  601
  602
  603
  604
  605
  606
  607
  608
  609
  610
  611
  612
  613
  614
  615
  616
  617
  618
  619
  620
  621
  622
  623
  624
  625
  626
  627
  628
  629
  630
  631
  632
  633
  634
  635
  636
  637
  638
  639
  640
  641
  642
  643
  644
  645
  646
  647
  648
  649
  650
  651
  652
  653
  654
  655
  656
  657
  658
  659
  660
  661
  662
  663
  664
  665
  666
  667
  668
  669
  670
  671
  672
  673
  674
  675
  676
  677
  678
  679
  680
  681
  682
  683
  684
  685
  686
  687
  688
  689
  690
  691
  692
  693
  694
  695
  696
  697
  698
  699
  700
  701
  702
  703
  704
  705
  706
  707
  708
  709
  710
  711
  712
  713
  714
  715
  716
  717
  718
  719
  720
  721
  722
  723
  724
  725
  726
  727
  728
  729
  730
  731
  732
  733
  734
  735
  736
  737
  738
  739
  740
  741
  742
  743
  744
  745
  746
  747
  748
  749
  750
  751
  752
  753
  754
  755
  756
  757
  758
  759
  760
  761
  762
  763
  764
  765
  766
  767
  768
  769
  770
  771
  772
  773
  774
  775
  776
  777
  778
  779
  780
  781
  782
  783
  784
  785
  786
  787
  788
  789
  790
  791
  792
  793
  794
  795
  796
  797
  798
  799
  800
  801
  802
  803
  804
  805
  806
  807
  808
  809
  810
  811
  812
  813
  814
  815
  816
  817
  818
  819
  820
  821
  822
  823
  824
  825
  826
  827
  828
  829
  830
  831
  832
  833
  834
  835
  836
  837
  838
  839
  840
  841
  842
  843
  844
  845
  846
  847
  848
  849
  850
  851
  852
  853
  854
  855
  856
  857
  858
  859
  860
  861
  862
  863
  864
  865
  866
  867
  868
  869
  870
  871
  872
  873
  874
  875
  876
  877
  878
  879
  880
  881
  882
  883
  884
  885
  886
  887
  888
  889
  890
  891
  892
  893
  894
  895
  896
  897
  898
  899
  900
  901
  902
  903
  904
  905
  906
  907
  908
  909
  910
  911
  912
  913
  914
  915
  916
  917
  918
  919
  920
  921
  922
  923
  924
  925
  926
  927
  928
  929
  930
  931
  932
  933
  934
  935
  936
  937
  938
  939
  940
  941
  942
  943
  944
  945
  946
  947
  948
  949
  950
  951
  952
  953
  954
  955
  956
  957
  958
  959
  960
  961
  962
  963
  964
  965
  966
  967
  968
  969
  970
  971
  972
  973
  974
  975
  976
  977
  978
  979
  980
  981
  982
  983
  984
  985
  986
  987
  988
  989
  990
  991
  992
  993
  994
  995
  996
  997
  998
  999
 1000
 1001
 1002
 1003
 1004
 1005
 1006
 1007
 1008
 1009
 1010
 1011
 1012
 1013
 1014
 1015
 1016
 1017
 1018
 1019
 1020
 1021
 1022
 1023
 1024
 1025
 1026
 1027
 1028
 1029
 1030
 1031
 1032
 1033
 1034
 1035
 1036
 1037
 1038
 1039
 1040
 1041
 1042
 1043
 1044
 1045
 1046
 1047
 1048
 1049
 1050
 1051
 1052
 1053
 1054
 1055
 1056
 1057
 1058
 1059
 1060
 1061
 1062
 1063
 1064
 1065
 1066
 1067
 1068
 1069
 1070
 1071
 1072
 1073
 1074
 1075
 1076
 1077
 1078
 1079
 1080
 1081
 1082
 1083
 1084
 1085
 1086
 1087
 1088
 1089
 1090
 1091
 1092
 1093
 1094
 1095
 1096
 1097
 1098
 1099
 1100
 1101
 1102
 1103
 1104
 1105
 1106
 1107
 1108
 1109
 1110
 1111
 1112
 1113
 1114
 1115
 1116
 1117
 1118
 1119
 1120
 1121
 1122
 1123
 1124
 1125
 1126
 1127
 1128
 1129
 1130
 1131
 1132
 1133
 1134
 1135
 1136
 1137
 1138
 1139
 1140
 1141
 1142
 1143
 1144
 1145
 1146
 1147
 1148
 1149
 1150
 1151
 1152
 1153
 1154
 1155
 1156
 1157
 1158
 1159
 1160
 1161
 1162
 1163
 1164
 1165
 1166
 1167
 1168
 1169
 1170
 1171
 1172
 1173
 1174
 1175
 1176
 1177
 1178
 1179
 1180
 1181
 1182
 1183
 1184
 1185
 1186
 1187
 1188
 1189
 1190
 1191
 1192
 1193
 1194
 1195
 1196
 1197
 1198
 1199
 1200
 1201
 1202
 1203
 1204
 1205
 1206
 1207
 1208
 1209
 1210
 1211
 1212
 1213
 1214
 1215
 1216
 1217
 1218
 1219
 1220
 1221
 1222
 1223
 1224
 1225
 1226
 1227
 1228
 1229
 1230
 1231
 1232
 1233
 1234
 1235
 1236
 1237
 1238
 1239
 1240
 1241
 1242
 1243
 1244
 1245
 1246
 1247
 1248
 1249
 1250
 1251
 1252
 1253
 1254
 1255
 1256
 1257
 1258
 1259
 1260
 1261
 1262
 1263
 1264
 1265
 1266
 1267
 1268
 1269
 1270
 1271
 1272
 1273
 1274
 1275
 1276
 1277
 1278
 1279
 1280
 1281
 1282
 1283
 1284
 1285
 1286
 1287
 1288
 1289
 1290
 1291
 1292
 1293
 1294
 1295
 1296
 1297
 1298
 1299
 1300
 1301
 1302
 1303
 1304
 1305
 1306
 1307
 1308
 1309
 1310
 1311
 1312
 1313
 1314
 1315
 1316
 1317
 1318
 1319
 1320
 1321
 1322
 1323
 1324
 1325
 1326
 1327
 1328
 1329
 1330
 1331
 1332
 1333
 1334
 1335
 1336
 1337
 1338
 1339
 1340
 1341
 1342
 1343
 1344
 1345
 1346
 1347
 1348
 1349
 1350
 1351
 1352
 1353
 1354
 1355
 1356
 1357
 1358
 1359
 1360
 1361
 1362
 1363
 1364
 1365
 1366
 1367
 1368
 1369
 1370
 1371
 1372
 1373
 1374
 1375
 1376
 1377
 1378
 1379
 1380
 1381
 1382
 1383
 1384
 1385
 1386
 1387
 1388
 1389
 1390
 1391
 1392
 1393
 1394
 1395
 1396
 1397
 1398
 1399
 1400
 1401
 1402
 1403
 1404
 1405
 1406
 1407
 1408
 1409
 1410
 1411
 1412
 1413
 1414
 1415
 1416
 1417
 1418
 1419
 1420
 1421
 1422
 1423
 1424
 1425
 1426
 1427
 1428
 1429
 1430
 1431
 1432
 1433
 1434
 1435
 1436
 1437
 1438
 1439
 1440
 1441
 1442
 1443
 1444
 1445
 1446
 1447
 1448
 1449
 1450
 1451
 1452
 1453
 1454
 1455
 1456
 1457
 1458
 1459
 1460
 1461
 1462
 1463
 1464
 1465
 1466
 1467
 1468
 1469
 1470
 1471
 1472
 1473
 1474
 1475
 1476
 1477
 1478
 1479
 1480
 1481
 1482
 1483
 1484
 1485
 1486
 1487
 1488
 1489
 1490
 1491
 1492
 1493
 1494
 1495
 1496
 1497
 1498
 1499
 1500
 1501
 1502
 1503
 1504
 1505
 1506
 1507
 1508
 1509
 1510
 1511
 1512
 1513
 1514
 1515
 1516
 1517
 1518
 1519
 1520
 1521
 1522
 1523
 1524
 1525
 1526
 1527
 1528
 1529
 1530
 1531
 1532
 1533
 1534
 1535
 1536
 1537
 1538
 1539
 1540
 1541
 1542
 1543
 1544
 1545
 1546
 1547
 1548
 1549
 1550
 1551
 1552
 1553
 1554
 1555
 1556
 1557
 1558
 1559
 1560
 1561
 1562
 1563
 1564
 1565
 1566
 1567
 1568
 1569
 1570
 1571
 1572
 1573
 1574
 1575
 1576
 1577
 1578
 1579
 1580
 1581
 1582
 1583
 1584
 1585
 1586
 1587
 1588
 1589
 1590
 1591
 1592
 1593
 1594
 1595
 1596
 1597
 1598
 1599
 1600
 1601
 1602
 1603
 1604
 1605
 1606
 1607
 1608
 1609
 1610
 1611
 1612
 1613
 1614
 1615
 1616
 1617
 1618
 1619
 1620
 1621
 1622
 1623
 1624
 1625
 1626
 1627
 1628
 1629
 1630
 1631
 1632
 1633
 1634
 1635
 1636
 1637
 1638
 1639
 1640
 1641
 1642
 1643
 1644
 1645
 1646
 1647
 1648
 1649
 1650
 1651
 1652
 1653
 1654
 1655
 1656
 1657
 1658
 1659
 1660
 1661
 1662
 1663
 1664
 1665
 1666
 1667
 1668
 1669
 1670
 1671
 1672
 1673
 1674
 1675
 1676
 1677
 1678
 1679
 1680
 1681
 1682
 1683
 1684
 1685
 1686
 1687
 1688
 1689
 1690
 1691
 1692
 1693
 1694
 1695
 1696
 1697
 1698
 1699
 1700
 1701
 1702
 1703
 1704
 1705
 1706
 1707
 1708
 1709
 1710
 1711
 1712
 1713
 1714
 1715
 1716
 1717
 1718
 1719
 1720
 1721
 1722
 1723
 1724
 1725
 1726
 1727
 1728
 1729
 1730
 1731
 1732
 1733
 1734
 1735
 1736
 1737
 1738
 1739
 1740
 1741
 1742
 1743
 1744
 1745
 1746
 1747
 1748
 1749
 1750
 1751
 1752
 1753
 1754
 1755
 1756
 1757
 1758
 1759
 1760
 1761
 1762
 1763
 1764
 1765
 1766
 1767
 1768
 1769
 1770
 1771
 1772
 1773
 1774
 1775
 1776
 1777
 1778
 1779
 1780
 1781
 1782
 1783
 1784
 1785
 1786
 1787
 1788
 1789
 1790
 1791
 1792
 1793
 1794
 1795
 1796
 1797
 1798
 1799
 1800
 1801
 1802
 1803
 1804
 1805
 1806
 1807
 1808
 1809
 1810
 1811
 1812
 1813
 1814
 1815
 1816
 1817
 1818
 1819
 1820
 1821
 1822
 1823
 1824
 1825
 1826
 1827
 1828
 1829
 1830
 1831
 1832
 1833
 1834
 1835
 1836
 1837
 1838
 1839
 1840
 1841
 1842
 1843
 1844
 1845
 1846
 1847
 1848
 1849
 1850
 1851
 1852

BUILD.gn [blame]

# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This is the root build file for GN. GN will start processing by loading this
# file, and recursively load all dependencies until all dependencies are either
# resolved or known not to exist (which will cause the build to fail). So if
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.

import("//build/config/cast.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/cronet/config.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/features.gni")
import("//build/config/ios/config.gni")
import("//build/config/rust.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/gn_logs.gni")
import("//build/util/generate_wrapper.gni")
import("//chrome/enterprise_companion/buildflags.gni")
import("//components/enterprise/buildflags/buildflags.gni")
import("//components/nacl/features.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
import("//gpu/vulkan/features.gni")
import("//media/gpu/args.gni")
import("//media/media_options.gni")
import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//remoting/remoting_enable.gni")
import("//services/on_device_model/on_device_model.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
import("//ui/base/ui_features.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")

if (is_android) {
  import("//build/config/android/config.gni")
}

if (is_fuchsia) {
  import("//build/config/fuchsia/generate_runner_scripts.gni")
  import("//third_party/fuchsia-gn-sdk/src/component.gni")
  import("//third_party/fuchsia-gn-sdk/src/package.gni")
} else {
  import("//chrome/browser/buildflags.gni")
}

if (is_linux) {
  import("build/config/linux/gtk/gtk.gni")
}

if (use_blink) {
  import("//v8/gni/snapshot_toolchain.gni")
}

declare_args() {
  # A list of extra dependencies to add to the root target. This allows a
  # checkout to add additional targets without explicitly changing any checked-
  # in files.
  root_extra_deps = []
}

if (is_official_build) {
  # An official (maximally optimized!) component (optimized for build times)
  # build doesn't make sense and usually doesn't work.
  assert(!is_component_build)
}

# The `gn_all` target is used to list all of the main targets in the build, so
# that we can figure out which BUILD.gn files to process, following the process
# described at the top of this file.
#
# Because of the way GN works (again, as described above), there may be targets
# built by `all` that aren't built by `gn_all`. We always want `all` to build,
# so there's really never a reason you'd want to build `gn_all` instead of
# `all`, and no tooling should depend directly on this target. Tools should
# should depend on either an explicit list of targets, or `all`.

group("gn_all") {
  testonly = true

  if (is_cronet_build) {
    if (is_android) {
      deps = [ "//components/cronet/android:cronet_package_android" ]
    } else {
      deps = []
    }
  } else {
    deps = [
      "//base:base_perftests",
      "//base:base_unittests",
      "//codelabs",
      "//components:components_unittests",
      "//components/gwp_asan:gwp_asan_unittests",
      "//infra/orchestrator:orchestrator_all",
      "//net:net_unittests",
      "//sandbox:sandbox_unittests",
      "//services:services_unittests",
      "//services/service_manager/public/cpp",
      "//skia:skia_unittests",
      "//sql:sql_unittests",
      "//testing/libfuzzer/tests",
      "//third_party/angle/src/tests:angle_end2end_tests",
      "//third_party/angle/src/tests:angle_unittests",
      "//third_party/angle/src/tests:angle_white_box_tests",
      "//third_party/distributed_point_functions/shim:distributed_point_functions_shim_unittests",
      "//third_party/flatbuffers:flatbuffers_unittests",
      "//third_party/liburlpattern:liburlpattern_unittests",
      "//third_party/rapidhash:rapidhash_fuzztests",
      "//tools/binary_size:binary_size_trybot_py",
      "//tools/ipc_fuzzer:ipc_fuzzer_all",
      "//tools/metrics:metrics_metadata",
      "//ui/base:ui_base_unittests",
      "//ui/gfx:gfx_unittests",
      "//ui/tests:ui_unittests",
      "//url:url_unittests",
    ]

    if (current_cpu == "arm64" && is_android && host_os == "linux") {
      deps += [
        "//components/allocation_recorder/tools:dump_allocation_recorder_data",
      ]
    }

    if (!is_component_build) {
      deps += [ "//third_party/abseil-cpp:absl_tests" ]
    }

    if (is_chromeos_ash && enable_js_type_check) {
      deps += [ ":webui_closure_compile" ]
    }

    if (!is_android && !is_castos) {
      deps += [
        "//crypto:crypto_unittests",
        "//google_apis/gcm:gcm_unit_tests",
      ]
    }

    if (!is_ios && !is_android && !is_castos) {
      if (!is_fuchsia) {
        deps += [
          "//chrome",
          "//chrome/browser/ui/actions:dump_actions",
          "//chrome/browser/ui/color:dump_colors",
          "//chrome/test:browser_tests",
        ]
      }
      deps += [
        "//components/subresource_filter/tools:subresource_filter_tools",
        "//components/zucchini:zucchini",
        "//net:hpack_example_generator",
        "//third_party/spirv-tools/src:SPIRV-Tools",
        "//tools/aggregation_service:aggregation_service_tool",
        "//tools/perf/clear_system_cache",
        "//tools/polymer:polymer_tools_python_unittests",
        "//tools/privacy_budget:privacy_budget_tools",
        "//ui/accessibility/extensions:extensions",
      ]
    }

    if (!is_castos && !is_fuchsia) {
      deps += [ "//chrome/installer" ]
    }

    if (!is_fuchsia && enable_updater) {
      deps += [ "//chrome/updater" ]
    }

    if (enable_enterprise_companion) {
      deps += [ "//chrome/enterprise_companion" ]
    }

    if (enable_ppapi) {
      deps += [
        "//ppapi:ppapi_unittests",
        "//ppapi/examples",
      ]
    }

    if (!is_ios && !is_castos) {
      if (!is_fuchsia) {
        deps += [ "//chrome/test:unit_tests" ]
      }
      deps += [ "//ui/accessibility:accessibility_unittests" ]
    }

    if (use_blink) {
      deps += [
        "//cc:cc_unittests",
        "//components/policy:policy_templates",
        "//components/url_formatter/tools:format_url",
        "//components/viz:viz_perftests",
        "//components/viz:viz_unittests",
        "//content/browser/interest_group/tools:adjustable_auction",
        "//content/shell:content_shell",
        "//content/test:content_browsertests",
        "//content/test:content_unittests",
        "//device:device_unittests",
        "//gpu:gpu_benchmark",
        "//gpu:gpu_unittests",
        "//media:media_unittests",
        "//media/capture:capture_unittests",
        "//media/cast:cast_unittests",
        "//media/midi:midi_unittests",
        "//media/mojo:media_mojo_unittests",
        "//mojo",
        "//mojo:mojo_unittests",
        "//storage:storage_unittests",
        "//third_party/blink/common:blink_common_unittests",
        "//third_party/blink/renderer/controller:blink_unittests",
        "//third_party/blink/renderer/platform:blink_platform_unittests",
        "//third_party/blink/renderer/platform/heap:blink_heap_unittests",
        "//third_party/blink/renderer/platform/wtf:wtf_unittests",
        "//third_party/libjingle_xmpp:libjingle_xmpp_unittests",
        "//tools/imagediff",
        "//tools/memory:all",
        "//ui/display:display_unittests",
        "//ui/gl:gl_unittests",
        "//ui/latency:latency_unittests",
        "//ui/native_theme:native_theme_unittests",
        "//ui/touch_selection:ui_touch_selection_unittests",
        "//v8:gn_all",
      ]

      if (!v8_use_external_startup_data) {
        deps += [ "//v8:v8_snapshot" ]
      }
    }

    if (!is_ios) {
      deps += [
        ":chromedriver_group",
        "//components:components_browsertests",
        "//ipc:ipc_tests",
        "//net:net_perftests",
        "//ui/events:events_unittests",
        "//url/ipc:url_ipc_unittests",
      ]
    }

    if (!is_ios && !is_android) {
      deps += [ "//components/viz/demo:viz_demo" ]
    }

    if (!is_ios) {
      deps += [
        "//google_apis/gcm:mcs_probe",
        "//third_party/catapult/telemetry:bitmaptools($host_toolchain)",
      ]
      if (!is_android) {
        if (!is_castos && !is_fuchsia) {
          deps += [ "//chrome/test:telemetry_perf_unittests" ]
        }
      } else {
        import("//tools/perf/chrome_telemetry_build/android_browser_types.gni")
        foreach(_target_suffix, telemetry_android_browser_target_suffixes) {
          deps += [ "//chrome/test:telemetry_perf_unittests${_target_suffix}" ]
        }
      }
    } else {
      deps += [
        "//ios:all",
        "//third_party/crashpad/crashpad:crashpad_tests",
      ]
    }

    if (is_fuchsia) {
      # Add targets that only exist on Fuchsia.
      deps += [
        ":d8_fuchsia",
        "//build/fuchsia/cipd",
        "//fuchsia_web:gn_all",
        "//tools/fuchsia/size_tests:fuchsia_sizes",

        # Ensure this target continues to build.
        "//chromecast/bindings:bindings_manager_fuchsia",
      ]
    }

    deps += root_extra_deps

    if (enable_printing || enable_printing_tests) {
      deps += [ "//printing:printing_unittests" ]
    }

    if (enable_extensions) {
      deps += [
        "//extensions:extensions_browsertests",
        "//extensions:extensions_unittests",
        "//extensions/browser/api/declarative_net_request/filter_list_converter",
        "//extensions/shell:app_shell_unittests",
      ]
    }

    if (enable_ml_internal) {
      deps +=
          [ "//components/optimization_guide/internal:ondevice_model_example" ]
    }

    if (enable_pdf) {
      deps += [
        "//pdf/pdfium/fuzzers",
        "//third_party/pdfium/testing:pdfium_test",
      ]
    }

    if (enable_remoting) {
      deps += [ "//remoting:remoting_all" ]
    }

    if (toolkit_views) {
      deps += [
        "//ui/views:views_unittests",
        "//ui/views/examples:views_examples",
        "//ui/views/examples:views_examples_unittests",
        "//ui/views/examples:views_examples_with_content",
      ]
    }

    if (enterprise_watermark) {
      deps += [ "//chrome/browser/enterprise/watermark:watermark_app" ]
    }

    if (use_aura) {
      deps += [
        "//ui/aura:aura_demo",
        "//ui/aura:aura_unittests",
        "//ui/wm:wm_unittests",
      ]
    }

    if (use_aura || is_mac) {
      deps += [ "//ui/webui/examples:webui_examples" ]
    }

    if (use_ozone) {
      deps += [
        "//ui/ozone",
        "//ui/ozone:unittests",
      ]
      if (!is_fuchsia) {
        deps += [ "//ui/ozone/demo" ]
      }
    }

    if (is_win) {
      deps += [
        "//chrome/credential_provider",
        "//chrome/credential_provider/test:gcp_unittests",

        # TODO(grt): Remove when chrome depends on the service.
        "//chrome/windows_services/elevated_tracing_service",
      ]

      if (enable_platform_experience) {
        deps += [
          "//chrome/browser/platform_experience/win:platform_experience_helper",
        ]
      }
    }

    if (is_mac) {
      deps += [
        "//chrome/installer/gcapi_mac:gcapi_example",
        "//tools/mac",
      ]
    }

    # Allow building md5sum tool for other OSes (android is added below).
    # For Windows, see: crbug.com/1090428.
    # TODO(cavalcantii): move it out of 'android' folder.
    if (!is_win) {
      deps += [ "//tools/android/md5sum" ]
    }

    if (is_android) {
      deps += [
        "//base:base_junit_tests",
        "//base/android/linker:chromium_android_linker",
        "//build/android/gyp/test:hello_world",
        "//build/android/stacktrace:java_deobfuscate",
        "//build/config/android/test/proto:test_build_protos",
        "//build/private_code_test:private_paths",
        "//chrome/android/monochrome:monochrome_public_apk_checker",
        "//chrome/android/webapk/shell_apk:webapk",
        "//chrome/android/webapk/shell_apk/prepare_upload_dir:prepare_webapk_shell_upload_dir",
        "//chrome/test:android_browsertests",
        "//components:components_junit_tests",
        "//content/public/android:content_junit_tests",
        "//content/shell/android:content_shell_apk",
        "//device:device_junit_tests",
        "//media/gpu:video_decode_accelerator_unittest",
        "//net/android:net_junit_tests",
        "//services:services_junit_tests",
        "//testing/android/junit:junit_unit_tests",
        "//third_party/android_build_tools/lint:custom_lint_java",
        "//third_party/androidx_javascriptengine",
        "//third_party/catapult/devil",
        "//third_party/jni_zero:jni_zero_tests",
        "//third_party/r8:custom_d8_java",
        "//tools/android:android_tools",
        "//tools/android:memconsumer",
        "//tools/android:push_apps_to_background",
        "//tools/android/audio_focus_grabber:audio_focus_grabber_apk",
        "//tools/android/customtabs_benchmark:customtabs_benchmark_apk",
        "//tools/android/kerberos/SpnegoAuthenticator:spnego_authenticator_apk",
        "//ui:ui_junit_tests",
      ]
      deps -= [
        "//net:net_perftests",
        "//url:url_unittests",
      ]

      if (!is_cast_android) {
        deps += [
          "//android_webview:empty_group",
          "//android_webview/test",
          "//android_webview/tools/automated_ui_tests:webview_ui_test_app_test_apk",
          "//android_webview/tools/captured_sites_tests:captured_sites_test_app",
          "//android_webview/tools/sdk_sandbox",
          "//android_webview/tools/system_webview_shell",
          "//chrome/android:chrome_junit_tests",
          "//chrome/android:chrome_public_apk",
          "//chrome/android:chrome_public_test_apk",
          "//chrome/android:chrome_public_unit_test_apk",
          "//chrome/browser/android/examples/custom_tabs_client:custom_tabs_client_example_apk",
          "//chrome/browser/android/examples/partner_browser_customizations_provider:partner_browser_customizations_example_apk",
          "//content/shell/android:content_shell_test_apk",
        ]
      }

      if (enable_chrome_android_internal) {
        deps += [
          "//clank",
          "//tools/pgo:generate_profile_android_clank_trichrome_bundle",
        ]
      }
    }

    if (is_linux || is_chromeos || is_android) {
      deps += [
        "//third_party/breakpad:breakpad_unittests",
        "//third_party/breakpad:core-2-minidump",
        "//third_party/breakpad:generate_test_dump",
        "//third_party/breakpad:minidump-2-core",
        "//tools/dump_process_memory:dump_process",
      ]
    }

    if (is_chromeos_ash) {
      deps += [
        "//ash:ash_unittests",
        "//ash/components:ash_components_unittests",
        "//ash/keyboard/ui:keyboard_unittests",
        "//ash/webui:ash_webui_unittests",
        "//chrome/browser/ash/child_accounts/time_limit_consistency_test:usage_time_limit_unittests",
        "//chrome/browser/metrics/perf:profile_provider_unittest",
        "//chromeos/ash/components/proximity_auth:proximity_auth_unittests",
        "//chromeos/components:chromeos_components_unittests",
        "//components/exo/wayland:wayland_client_compatibility_tests",
        "//components/session_manager/core",
        "//third_party/shell-encryption:shell_encryption_unittests",
        "//ui/chromeos:ui_chromeos_unittests",
      ]
    }

    if (is_chromeos) {
      deps += [ "//chromeos:chromeos_unittests" ]
    }

    if (is_chromeos_ash || is_mac || is_win) {
      deps += [
        "//rlz:rlz_id",
        "//rlz:rlz_lib",
        "//rlz:rlz_unittests",
      ]
    }

    if (is_linux || is_chromeos) {
      # The following are definitely linux-only.
      deps += [
        "//net:disk_cache_memory_test",
        "//net:quic_client",
        "//net:quic_server",
        "//sandbox/linux:chrome_sandbox",
        "//sandbox/linux:sandbox_linux_unittests",
      ]
      if (!is_clang) {
        deps += [ "//testing:empty_main" ]
      }

      if (!is_castos) {
        deps += [ "//chrome:xdg_mime" ]
      }

      if (use_dbus) {
        deps += [
          "//dbus:dbus_test_server",
          "//dbus:dbus_unittests",
        ]
      }

      if (is_chrome_branded && is_official_build) {
        # TODO(dpranke): add the linux_dump_symbols flag?
        deps += [ "//chrome:linux_symbols" ]
      }
    }

    if (is_ios || is_win || is_linux || is_chromeos_lacros || is_fuchsia) {
      deps += [
        "//base:base_i18n_perftests",
        "//google_apis:google_apis_unittests",
      ]
    }

    if ((is_win || is_mac || is_linux || is_chromeos || is_fuchsia) &&
        (target_cpu == "x86" || target_cpu == "x64")) {
      deps += [
        "//third_party/swiftshader/src/Vulkan:icd_file",
        "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
      ]
    }

    # TODO(GYP): Figure out which of these should (and can) build
    # for Chrome OS and iOS (without blink).
    if (!is_chromeos_ash && use_blink) {
      deps += [
        "//cc:cc_perftests",
        "//device:device_unittests",
        "//gin:gin_shell",
        "//gin:gin_unittests",
        "//gpu:command_buffer_perftests",
        "//gpu:gl_tests",
        "//gpu:gpu_perftests",
        "//media:media_perftests",
        "//third_party/libphonenumber:libphonenumber_unittests",
        "//ui/compositor:compositor_unittests",
      ]

      if (!is_ios) {
        deps += [
          "//base:build_utf8_validator_tables",
          "//base:check_example",
          "//components:components_perftests",
          "//ipc:ipc_perftests",
          "//net:dump_cache",
        ]
      }

      if (!is_android && !is_castos && !is_ios && !is_fuchsia) {
        deps += [
          "//chrome/test:load_library_perf_tests",
          "//chrome/test:sync_performance_tests",
        ]
      }

      if (!is_android && !is_ios) {
        deps += [
          "//net:crash_cache",
          "//net:net_watcher",  # TODO(GYP): This should be conditional on
                                # use_v8_in_net
          "//net:run_testserver",
          "//net:stress_cache",
          "//net:tld_cleanup",
          "//third_party/leveldatabase:env_chromium_unittests",
          "//third_party/libaddressinput:libaddressinput_unittests",
        ]
      }

      if (enable_extensions) {
        deps += [ "//extensions/shell:app_shell" ]
      }

      # TODO(https://crbug.com/1299021): These dependencies might be
      # redundant given that we were able to disable them, apparently without
      # negative consequences, for the ARM32-NaCl-on-ARM64 case.
      if (enable_nacl) {
        if (target_cpu != "arm64") {
          deps += [ "//components/nacl/loader:nacl_loader_unittests" ]
        }

        if (is_linux || is_chromeos) {
          # TODO(dpranke): Figure out what platforms should actually have this.
          deps += [ "//components/nacl/loader:nacl_helper" ]
        }
      }

      if (media_use_ffmpeg && !is_android) {
        deps += [ "//media:ffmpeg_regression_tests" ]
      }
    }

    if (enable_ppapi) {
      deps += [
        "//ppapi:pepper_hash_for_uma",
        "//ppapi:ppapi_perftests",
      ]
    }

    if (is_android || is_linux || is_chromeos_lacros) {
      deps += [
        "//components/network_hints/browser",
        "//content/public/app",
        "//mojo:mojo_perftests",
        "//services/service_manager/public/cpp",
        "//testing/gmock:gmock_main",
        "//third_party/breakpad:dump_syms($host_system_allocator_toolchain)",
        "//third_party/breakpad:microdump_stackwalk($host_system_allocator_toolchain)",
        "//third_party/breakpad:minidump_dump($host_system_allocator_toolchain)",
        "//third_party/breakpad:minidump_stackwalk($host_system_allocator_toolchain)",
      ]
    }

    if (is_linux || is_chromeos_lacros) {
      deps += [
        "//skia:filter_fuzz_stub",
        "//skia:image_operations_bench",
        "//ui/snapshot:snapshot_unittests",
      ]

      if (!is_castos) {
        deps += [ "//chrome/test:chrome_app_unittests" ]
      }

      if (!is_debug && !is_component_build && !is_castos) {
        deps += [ "//chrome/tools/service_discovery_sniffer" ]
      }
    }

    if (is_mac) {
      deps += [
        "//third_party/breakpad:dump_syms($host_system_allocator_toolchain)",

        # The following are accessibility API tools.
        "//tools/accessibility/inspect:ax_dump_events",
        "//tools/accessibility/inspect:ax_dump_tree",
      ]
      deps -= [
        # Mojo in GN contains some things which are never compiled in GYP on Mac,
        # so compilation fails on Mac. They need porting.
        "//mojo",
      ]
    }

    if (is_win) {
      deps += [
        "//base:pe_image_test",
        "//chrome/chrome_elf:chrome_elf_unittests",
        "//chrome/chrome_elf:dll_hash_main",
        "//chrome/elevation_service:elevation_service_unittests",
        "//chrome/install_static:install_static_unittests",
        "//chrome/installer/gcapi",
        "//chrome/installer/setup:setup_unittests",
        "//chrome/notification_helper:notification_helper_unittests",
        "//chrome/test:delayloads_unittests",
        "//components/wifi:wifi_test",
        "//components/zucchini",
        "//net:quic_client",
        "//net:quic_server",
        "//sandbox/win:sbox_integration_tests",
        "//sandbox/win:sbox_unittests",
        "//sandbox/win:sbox_validation_tests",
        "//testing/gtest:gtest_main",

        # The following two are accessibility API debugging tools.
        "//tools/accessibility/inspect:ax_dump_events",
        "//tools/accessibility/inspect:ax_dump_tree",
        "//tools/win/chromeexts:chromeexts",
      ]

      # TODO(thakis): Enable this in cross builds, https://crbug.com/799827
      if (!(is_component_build && is_debug && target_cpu == "x86") &&
          host_os == "win") {
        deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
      }
    }

    if (!is_fuchsia) {
      # The official builders use this binary from the default toolchain's
      # output directory after building in order to upload the symbols of that
      # binary. They build the binary like `ninja symupload` which requires the
      # target to be a dependency in the default_toolchain from `gn_all` for the
      # name to resolve.
      deps += [ "//third_party/breakpad:symupload" ]
    }
    if (is_mac && host_cpu == "arm64") {
      # TODO(crbug.com/349268750): This alias exists because the official Mac
      # arm64 builders (which cross-build the x64 binaries) use the hardcoded
      # path of the `$host_toolchain/symupload` to build and run the symupload
      # binary. And the same recipes are used on all branches!! So we would break
      # the stable branch builders by changing the recipe to build and run the
      # binary from the root_build_dir.
      #
      # Once this code is in stable, we can land the following CLs to change how
      # symupload is built and run on Mac arm64 official builders, and then this
      # alias can be removed.
      # Build: https://chrome-internal-review.googlesource.com/c/chrome/src-internal/+/7430844
      # Run: https://chrome-internal-review.googlesource.com/c/chrome/tools/release/scripts/+/7430843
      deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
    }

    if (is_cast_android || is_castos || (is_fuchsia && enable_cast_receiver)) {
      deps += [ "//chromecast:cast_test_lists" ]
    }

    if (is_cast_android || is_castos) {
      deps += [
        "//chromecast:cast_shell",
        "//chromecast/cast_core:core_runtime_simple",
      ]
    }

    if (is_mac || is_win || is_android || is_linux || is_chromeos) {
      deps += [
        "//third_party/crashpad/crashpad:crashpad_tests",
        "//third_party/crashpad/crashpad/handler:crashpad_handler",
        "//third_party/crashpad/crashpad/tools:crashpad_database_util",
      ]
    }

    if (enable_message_center) {
      deps += [ "//ui/message_center:message_center_unittests" ]
    }

    if (!is_android && !is_ios) {
      deps += [ "//content/browser/bluetooth/tools:bluetooth_metrics_hash" ]
    }

    if (is_win || is_linux || is_chromeos) {
      deps += [ "//mojo" ]
    }

    if (is_mac || is_linux || is_chromeos || is_android || is_fuchsia) {
      deps += [ "//third_party/perfetto:all" ]
    }

    if (is_win || is_mac || is_linux || is_chromeos) {
      deps += [ "//third_party/sqlite:sqlite_shell" ]
    }

    if ((is_linux && !is_castos) || is_chromeos_lacros || is_fuchsia) {
      # TODO(https://crbug.com/1329673): Figure out if this should be in gn_all
      # and how cross-platform this is.
      deps +=
          [ "//components/services/filesystem:filesystem_service_unittests" ]
    }

    if ((is_linux && !is_castos) || is_chromeos_lacros) {
      # TODO(https://crbug.com/1329673): Figure out if any of these should be in
      # gn_all and figure out how cross-platform they are.
      deps += [
        "//chrome/installer/util:strings",
        "//chrome/tools/convert_dict",
        "//components/constrained_window:unit_tests",
        "//components/metrics:serialization",
        "//components/sessions:unit_tests",
        "//storage/browser:dump_file_system",
        "//third_party/angle:libANGLE",
        "//third_party/angle:libEGL",
        "//third_party/angle:libGLESv2",
        "//third_party/leveldatabase:leveldb_test_targets",
        "//third_party/libjpeg_turbo:simd",
        "//third_party/opus:opus_compare",
        "//third_party/opus:opus_demo",
        "//third_party/opus:test_opus_api",
        "//third_party/opus:test_opus_decode",
        "//third_party/opus:test_opus_encode",
        "//third_party/opus:test_opus_padding",
        "//ui/display/types",
        "//ui/shell_dialogs:shell_dialogs_unittests",
      ]

      if (target_cpu == "x86" || target_cpu == "x64") {
        if (!is_android) {
          deps += [ "//chrome/test:load_library_perf_tests" ]
        }
        deps += [ "//third_party/libjpeg_turbo:simd_asm" ]
      }
      if ((is_linux || is_chromeos) && current_toolchain == host_toolchain) {
        deps += [ "//v8:v8_shell" ]
      }
    }

    if ((is_linux && !is_castos) || is_chromeos ||
        ((is_win || is_mac) && use_fuzzing_engine)) {
      deps += [
        "//testing/libfuzzer/fuzzers",
        "//third_party/freetype-testing:fuzzers",
        "//third_party/grpc:fuzzers",
        "//third_party/icu/fuzzers",
        "//third_party/qcms:fuzzers",
        "//third_party/ukey2/fuzzers",
        "//third_party/zlib/contrib/tests/fuzzers",
      ]

      if (is_chromeos_ash) {
        deps += [ "//chrome/services/ipp_parser/public/cpp:fuzzers" ]
      }
    }

    # TODO(https://crbug.com/1299021): Remove the special case for arm64.
    if (enable_nacl && target_cpu != "arm64") {
      deps += [ "//native_client_sdk/src:nacl_core_sdk" ]
    }

    if (((is_linux || is_chromeos) && use_ozone) || is_fuchsia) {
      deps += [
        "//headless:headless_non_renderer",
        "//headless:headless_tests",
      ]
    }

    if (enable_vr) {
      deps += [
        "//chrome/browser/vr:vr_common_perftests",
        "//chrome/browser/vr:vr_common_unittests",
      ]
      if (!is_android) {
        deps += [ "//tools/perf/contrib/vr_benchmarks:vr_perf_tests" ]
      } else {
        deps += [ "//chrome/browser/android/vr:vr_android_unittests" ]
        import("//tools/perf/chrome_telemetry_build/android_browser_types.gni")
        foreach(_target_suffix, telemetry_android_browser_target_suffixes) {
          deps += [
            "//tools/perf/contrib/vr_benchmarks:vr_perf_tests${_target_suffix}",
          ]
        }
      }
    }

    if (use_atk) {
      deps += [
        "//tools/accessibility/inspect:ax_dump_events",
        "//tools/accessibility/inspect:ax_dump_tree",
      ]
    }

    if (build_dawn_tests) {
      deps += [
        "//third_party/dawn/src/dawn/fuzzers:fuzzers",
        "//third_party/dawn/src/dawn/tests:dawn_end2end_tests",
        "//third_party/dawn/src/dawn/tests:dawn_unittests",
        "//third_party/dawn/src/tint:fuzzers",
        "//third_party/dawn/src/tint:tests",
      ]
    }

    # PFFFT.
    deps += [
      "//third_party/pffft:fuzzers",
      "//third_party/pffft:pffft_benchmark",
      "//third_party/pffft:pffft_unittest",
    ]

    # Rust build targets.
    if (enable_rust) {
      deps += [ ":all_rust" ]
    }

    if (!is_android && !is_ios) {
      deps += [ "//components/cronet:cronet_tests" ]
    }
  }

  if (is_chrome_for_testing) {
    deps += [ "//chrome/browser/chrome_for_testing:chrome_for_testing" ]
  }

  if (checkout_src_internal) {
    deps += [ "//internal:all" ]
  }
}

# All Rust targets. This is provided for convenience while developing Rust to
# e.g. test build config or toolchain changes.
group("all_rust") {
  testonly = true

  deps = [
    ":rust_build_tests",
    "third_party/cloud_authenticator/processor",
  ]

  # There is rust stuff behind flags in here.
  deps += [ "//base:base_unittests" ]

  if (enable_rust_mojo) {
    deps += [
      "//mojo/public/rust:mojo_rust",
      "//mojo/public/rust:mojo_rust_integration_unittests",
      "//mojo/public/rust:mojo_rust_unittests",
    ]
  }
  if (enable_rust_gtest_interop) {
    deps += [ "//testing/rust_gtest_interop:rust_gtest_interop_unittests" ]
  }
  if (enable_rust_png) {
    deps += [ "//skia" ]
  }
}

# This group exists to give targets for the waterfall to refer to.
group("rust_build_tests") {
  testonly = true
  deps = [ "//build/rust/tests" ]
}

# TODO(https://crbug.com/1112776): ensure remoting is functional on Linux builds with
# other than X11 Ozone backends.
if (enable_remoting && ((is_linux && ozone_platform_x11) ||
                        ((is_chromeos || is_win) && !use_ozone))) {
  # On CQ, run the Traffic Annotation Auditor when a change affects one of these
  # targets.
  group("traffic_annotation_auditor_dependencies") {
    deps = [
      "//chrome:chrome",
      "//remoting/host:host",
      "//tools/traffic_annotation:annotations_xml",
    ]
    if (enable_enterprise_companion) {
      deps += [ "//chrome/enterprise_companion" ]
    }
  }
}

if (is_chromeos_ash) {
  group("traffic_annotation_auditor_dependencies") {
    deps = [
      "//chrome",
      "//chromeos",
      "//tools/traffic_annotation:annotations_xml",
    ]
  }
}

if (is_android && !is_cronet_build) {
  # On CQ, run the Traffic Annotation Auditor when a change affects one of these
  # targets.
  group("traffic_annotation_auditor_dependencies") {
    deps = [
      "//chrome/android:chrome_public_apk",
      "//tools/traffic_annotation:annotations_xml",
    ]
  }
}

if (is_fuchsia) {
  # TODO(https://crbug.com/731217): This can't practically be in //v8 without
  # duplicating all the Fuchsia running infrastructure there.
  fuchsia_component("d8_component") {
    testonly = true
    manifest = "//v8/gni/v8.cml"
    data_deps = [ "//v8:d8" ]
  }
  fuchsia_package("d8_pkg") {
    testonly = true
    package_name = "d8"
    deps = [ ":d8_component" ]
  }
  fuchsia_package_installer("d8_fuchsia") {
    testonly = true
    package = ":d8_pkg"
    package_name = "d8"
  }
}

# TODO(GYP_GONE): Figure out if we really need this target or if there's
# some better way to specify things.
if (is_win) {
  group("chrome_official_builder_no_unittests") {
    deps = [
      "//chrome/common/win:eventlog_provider",
      "//chrome/credential_provider",
      "//chrome/enterprise_companion:enterprise_companion_zip",
      "//chrome/installer/gcapi",
      "//chrome/installer/mini_installer",
      "//chrome/updater/win:updater_zip",
      "//components/policy:pack_policy_templates",
      "//components/zucchini",
      "//components/zucchini:zucchini64",
      "//third_party/hyphenation-patterns",
      "//tools/metrics:metrics_metadata",
    ]

    if (is_chrome_branded) {
      deps += [ "//remoting/host:remoting_host_installation" ]
    }
    if (enable_platform_experience) {
      deps += [
        "//chrome/browser/platform_experience/win:platform_experience_helper",
      ]
    }
  }

  group("chrome_official_builder") {
    testonly = true

    deps = [
      ":blink_wpt_tests",
      ":chrome_official_builder_no_unittests",
      "//base:base_unittests",
      "//chrome/test:browser_tests",
      "//chrome/test:interactive_ui_tests",
      "//ipc:ipc_tests",
      "//media:media_unittests",
      "//media/midi:midi_unittests",
      "//net:net_unittests",
      "//sql:sql_unittests",
      "//third_party/breakpad:symupload",
      "//ui/base:ui_base_unittests",
      "//ui/gfx:gfx_unittests",
      "//ui/touch_selection:ui_touch_selection_unittests",
      "//ui/views:views_unittests",
      "//url:url_unittests",
    ]

    if (enable_printing || enable_printing_tests) {
      deps += [ "//printing:printing_unittests" ]
    }
  }
}

if (is_chromeos_ash) {
  # This group is used to collect all targets used when verifying a new version
  # of Chrome for Chrome OS.
  group("chromiumos_preflight") {
    testonly = true
    data_deps = [
      "//chrome",
      "//chrome/test/chromedriver:chromedriver_server",
      "//components/chromeos_camera:jpeg_decode_accelerator_unittest",
      "//components/exo/wayland:wayland_client_integration_tests",
      "//components/exo/wayland:wayland_client_perftests",
      "//components/exo/wayland:wayland_client_tests",
      "//components/exo/wayland:wayland_hdr_client",
      "//components/policy/test_support:fake_dmserver",
      "//media:media_unittests",
      "//media/capture:capture_unittests",
      "//sandbox/linux:chrome_sandbox",
      "//sandbox/linux:sandbox_linux_unittests",
      "//services/screen_ai:screen_ai_ocr_perf_test",
      "//third_party/breakpad:minidump_stackwalk($host_system_allocator_toolchain)",
      "//third_party/dawn/src/dawn/tests:dawn_end2end_tests",
      "//third_party/dawn/src/dawn/tests:dawn_unittests",
      "//ui/ozone:ozone_integration_tests",

      # Blocked on https://github.com/catapult-project/catapult/issues/2297
      #"//third_party/catapult/telemetry:bitmaptools",
      "//tools/perf/clear_system_cache",
      "//ui/ozone/gl:ozone_gl_unittests",
    ]

    if (enable_ppapi) {
      data_deps += [ "//ppapi/examples/video_decode" ]
    }

    if (use_v4l2_codec || use_vaapi) {
      data_deps += [
        "//components/chromeos_camera:jpeg_encode_accelerator_unittest",
        "//media/gpu/chromeos:image_processor_test",
        "//media/gpu/test/:video_decode_accelerator_perf_tests",
        "//media/gpu/test/:video_decode_accelerator_tests",
        "//media/gpu/test/:video_encode_accelerator_perf_tests",
        "//media/gpu/test/:video_encode_accelerator_tests",
      ]
      if (use_vaapi) {
        data_deps += [
          "//media/gpu/vaapi:decode_test",
          "//media/gpu/vaapi:vaapi_unittest",
          "//media/gpu/vaapi/test/fake_libva_driver:fake_libva_driver_unittest",
        ]
      }
      if (use_v4l2_codec) {
        data_deps += [
          "//media/gpu/chromeos:image_processor_perf_test",
          "//media/gpu/v4l2:v4l2_stateless_decoder",
          "//media/gpu/v4l2:v4l2_unittest",
        ]
      }
    }
  }
}

if (use_blink && !is_cronet_build) {
  group("chromedriver_group") {
    testonly = true

    if (is_fuchsia || is_android) {
      # On Fuchsia and non-Cast Android, ChromeDriver runs on the host, not the
      # device.
      if (!is_cast_android) {
        deps = [
          "//chrome/test/chromedriver:chromedriver_server($host_toolchain)",
        ]
      }
      if (is_android && !is_cast_android) {
        deps += [ "//chrome/test/chromedriver/test/webview_shell:chromedriver_webview_shell_apk" ]
      }
    } else if (!is_castos && !is_ios) {
      deps = [
        "//chrome/test/chromedriver:chromedriver_server",
        "//chrome/test/chromedriver:chromedriver_unittests",
        "//chrome/test/chromedriver:copy_license",
        "//chrome/test/chromedriver:generate_chromedriver_notices",
      ]
    }
  }

  # This group includes all of the targets needed to build and test Blink,
  # including running web tests (see below). This target is defined here because
  # previously //third_party/WebKit, now //third_party/blink, couldn't depend on
  # //content/shell. This might not longer be true, see
  # https://crbug.com/1018659.
  group("blink_tests") {
    testonly = true

    deps = [
      ":blink_web_tests",
      ":blink_wpt_tests",
      "//third_party/blink/public:all_blink",
    ]
  }

  # Options shared by all script test targets that call `run_web_tests.py` or
  # `run_wpt_tests.py`.
  _common_web_test_options = [
    "--no-show-results",
    "--zero-tests-executed-ok",
  ]
  if (is_debug) {
    _common_web_test_options += [ "--debug" ]
  } else {
    _common_web_test_options += [ "--release" ]
  }
  if (is_asan) {
    _common_web_test_options += [
      "--enable-sanitizer",
      "--additional-expectations",
      "@WrappedPath(" +
          rebase_path("//third_party/blink/web_tests/ASANExpectations",
                      root_out_dir) + ")",
    ]
  }
  if (is_msan) {
    _common_web_test_options += [
      "--enable-sanitizer",
      "--additional-expectations",
      "@WrappedPath(" +
          rebase_path("//third_party/blink/web_tests/MSANExpectations",
                      root_out_dir) + ")",
    ]
  }
  if (is_fuchsia) {
    _common_web_test_options += [
      "--out-dir",
      "@WrappedPath(.)",
    ]
  } else {
    base_out_dir = rebase_path(get_path_info(root_build_dir, "dir"), ".")
    out_dir = get_path_info(root_build_dir, "name")
    _common_web_test_options += [
      "--build-directory",
      base_out_dir,
      "--target",
      out_dir,
    ]
  }

  if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) {
    script_test("chrome_wpt_tests") {
      script = "//third_party/blink/tools/run_wpt_tests.py"
      args = _common_web_test_options + [ "--product=chrome" ]
      if (dcheck_always_on) {
        args += [ "--timeout-multiplier=2" ]
      } else {
        args += [ "--timeout-multiplier=1" ]
      }
      if (is_chrome_branded) {
        args += [
          "--driver-name",
          "Google Chrome",
        ]
      }
      data_deps = [
        ":blink_web_tests_expectations",
        ":blink_web_tests_support_data",
        "//chrome:chrome",
        "//chrome/test/chromedriver:chromedriver_server",
        "//third_party/blink/tools:wpt_tests_isolate",
      ]
    }
    script_test("headless_shell_wpt") {
      script = "//third_party/blink/tools/run_wpt_tests.py"
      args = _common_web_test_options + [
               "--product=headless_shell",
               "--no-wpt-internal",
             ]
      data_deps = [
        ":blink_web_tests_expectations",
        ":blink_web_tests_support_data",
        "//chrome/test/chromedriver:chromedriver_server",
        "//headless:headless_shell",
        "//third_party/blink/tools:wpt_tests_isolate",
      ]
      if (is_mac || is_linux) {
        data_deps += [ "//third_party/hyphenation-patterns:bundle_hyphen_data" ]
      }
    }
  }

  group("blink_web_tests_support_data") {
    testonly = true
    data_deps = [
      ":layout_test_data_mojo_bindings",
      ":layout_test_data_mojo_bindings_lite",
      "//content/shell:content_shell",
      "//content/test:mojo_bindings_web_test_mojom_js_data_deps",
      "//content/test:mojo_web_test_bindings_js_data_deps",
      "//device/bluetooth/public/mojom:fake_bluetooth_interfaces_js_data_deps",
      "//device/vr/public/mojom:vr_service_js_data_deps",
      "//media/capture/mojom:image_capture_js_data_deps",
      "//media/midi:mojo_js_data_deps",
      "//media/mojo/mojom:web_speech_recognition_js_data_deps",
      "//mojo/public/interfaces/bindings/tests:test_data_deps",
      "//mojo/public/js/ts/bindings/tests:test_interfaces_js_data_deps",
      "//mojo/public/mojom/base:base_js_data_deps",
      "//services/device/public/mojom:generic_sensor_js_data_deps",
      "//services/device/public/mojom:mojom_js_data_deps",
      "//services/device/public/mojom:usb_js_data_deps",
      "//services/shape_detection/public/mojom:mojom_js_data_deps",
      "//skia/public/mojom:mojom_js_data_deps",
      "//testing/buildbot/filters:blink_web_tests_filter",
      "//third_party/angle:includes",
      "//third_party/blink/public:blink_devtools_frontend_resources_files",
      "//third_party/blink/public:blink_devtools_inspector_resources",
      "//third_party/blink/public/mojom:mojom_platform_js_data_deps",
      "//third_party/blink/renderer/core:gen_files_for_web_tests",
      "//third_party/catapult/third_party/typ",
      "//third_party/hyphenation-patterns:test_data",
      "//tools/imagediff",
      "//ui/base:goldctl",
    ]

    if (is_android) {
      data_deps += [
        "//third_party/breakpad:breakpad_unittests",
        "//tools/android/forwarder2",

        # Using the target toolchain for this tool, as it's run during tests not
        # during the build. This places a symlink in the root_build_dir for
        # scrips to use.
        "//third_party/breakpad:dump_syms",
        "//third_party/breakpad:microdump_stackwalk",
        "//third_party/breakpad:minidump_dump",
        "//third_party/breakpad:minidump_stackwalk",
        "//third_party/breakpad:symupload",
      ]
    } else {
      data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
    }

    if (!is_win && !is_android) {
      # Using the default toolchain for this tool, as it's run during tests not
      # during the build. This places a symlink in the root_build_dir for scrips
      # to use.
      data_deps += [ "//third_party/breakpad:minidump_stackwalk" ]
    }

    if (is_mac) {
      # Using the default toolchain for this tool, as it's run during tests not
      # during the build, and on Mac we support cross-building from a different
      # architecture.
      data_deps += [ "//third_party/breakpad:dump_syms" ]
    }

    if (is_linux || is_chromeos) {
      # Using the default toolchain for this tool, as it's run during tests not
      # during the build. This places a symlink in the root_build_dir for scrips
      # to use.
      data_deps += [ "//third_party/breakpad:dump_syms" ]
    }

    if (is_fuchsia) {
      data_deps += [
        "//build/config/fuchsia:deployment_resources",
        "//content/shell:content_shell_fuchsia",
        "//content/shell:content_shell_pkg__archive-manifest",
        "//content/shell:content_shell_pkg__archive-metadata",
      ]
    }

    data = [
      "//build/skia_gold_common/",
      "//testing/scripts/common.py",
      "//testing/scripts/run_isolated_script_test.py",
      "//testing/xvfb.py",
      "//third_party/blink/tools/",
      "//third_party/blink/web_tests/external/wpt/.config.json",
      "//third_party/blink/web_tests/resources/",
      "//third_party/blink/web_tests/TestLists/",
      "//third_party/pywebsocket3/src/mod_pywebsocket/",
      "//third_party/test_fonts/test_fonts/",
      "//third_party/wpt_tools/",
    ]

    if (is_win) {
      data += [
        "//third_party/apache-win32/",
        "//third_party/apache-windows-arm64/",
        "//third_party/perl/perl/",
      ]
      data_deps += [ "//build/win:copy_cdb_to_output" ]
    }

    if (is_mac || (is_ios && target_environment == "simulator")) {
      data += [
        "//third_party/apache-mac/",
        "//third_party/apache-mac-arm64/",
      ]
    }

    if (is_linux || is_chromeos || is_fuchsia) {
      data += [ "//third_party/apache-linux/" ]
    }

    if (is_android) {
      data += [
        "//third_party/catapult/",
        "//build/android/",
      ]
    }
  }

  _common_web_test_script = "//testing/scripts/run_isolated_script_test.py"

  if (is_fuchsia) {
    _common_web_test_args = [
      "@WrappedPath(" +
          rebase_path("//build/fuchsia/test/run_test.py", root_build_dir) + ")",
      "blink",
      "--platform",
      "fuchsia",
      "--jobs",
      "1",
    ]
  } else {
    _common_web_test_args = [ "@WrappedPath(" + rebase_path(
                                  "//third_party/blink/tools/run_web_tests.py",
                                  root_build_dir) + ")" ]
  }
  _common_web_test_args += _common_web_test_options

  if (!is_debug) {
    if (dcheck_always_on) {
      _common_web_test_args += [ "--timeout-ms=12000" ]
    } else if (v8_enable_debugging_features) {
      # In a pure release build with a debug V8, tests run slower.
      _common_web_test_args += [ "--timeout-ms=30000" ]
    }
  }

  if (is_chrome_branded) {
    _common_web_test_args += [ "--chrome-branded" ]
  }

  if (is_android) {
    _common_web_test_args += [
      "--platform",
      "android",
    ]
  }

  _common_web_test_args += [
    "--seed",
    "4",
    "--debug-rwt-logging",
    "--clobber-old-results",
  ]

  # https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_tests.md
  script_test("blink_web_tests") {
    script = _common_web_test_script

    args = _common_web_test_args

    data_deps = [
      ":blink_web_tests_expectations",
      ":blink_web_tests_support_data",
    ]
    data = [
      "//third_party/blink/perf_tests/",
      "//third_party/blink/web_tests/VirtualTestSuites",

      # === List Test Cases folders here ===
      "//third_party/blink/web_tests/accessibility/",
      "//third_party/blink/web_tests/android/",
      "//third_party/blink/web_tests/animations/",
      "//third_party/blink/web_tests/app_banner/",
      "//third_party/blink/web_tests/bindings/",
      "//third_party/blink/web_tests/clipboard/",
      "//third_party/blink/web_tests/compositing/",
      "//third_party/blink/web_tests/crypto/",
      "//third_party/blink/web_tests/css-parser/",
      "//third_party/blink/web_tests/css1/",
      "//third_party/blink/web_tests/css2.1/",
      "//third_party/blink/web_tests/css3/",
      "//third_party/blink/web_tests/cssom/",
      "//third_party/blink/web_tests/custom-elements/",
      "//third_party/blink/web_tests/custom-properties/",
      "//third_party/blink/web_tests/dark-mode/",
      "//third_party/blink/web_tests/dom/",
      "//third_party/blink/web_tests/editing/",
      "//third_party/blink/web_tests/fast/",
      "//third_party/blink/web_tests/fonts/",
      "//third_party/blink/web_tests/fragmentation/",
      "//third_party/blink/web_tests/fullscreen/",
      "//third_party/blink/web_tests/gamepad/",
      "//third_party/blink/web_tests/harness-tests/",
      "//third_party/blink/web_tests/hittesting/",
      "//third_party/blink/web_tests/html/",
      "//third_party/blink/web_tests/html5lib/",
      "//third_party/blink/web_tests/http/",
      "//third_party/blink/web_tests/idle-callback/",
      "//third_party/blink/web_tests/ietestcenter/",
      "//third_party/blink/web_tests/images/",
      "//third_party/blink/web_tests/inspector-protocol/",
      "//third_party/blink/web_tests/intersection-observer/",
      "//third_party/blink/web_tests/jquery/",
      "//third_party/blink/web_tests/js/",
      "//third_party/blink/web_tests/loader/",
      "//third_party/blink/web_tests/media/",
      "//third_party/blink/web_tests/media_capabilities/",
      "//third_party/blink/web_tests/mhtml/",
      "//third_party/blink/web_tests/navigator_language/",
      "//third_party/blink/web_tests/navigator_webdriver/",
      "//third_party/blink/web_tests/netinfo/",
      "//third_party/blink/web_tests/overflow/",
      "//third_party/blink/web_tests/paint/",
      "//third_party/blink/web_tests/payments/",
      "//third_party/blink/web_tests/performance_timeline/",
      "//third_party/blink/web_tests/permissionclient/",
      "//third_party/blink/web_tests/plugins/",
      "//third_party/blink/web_tests/pointer-lock/",
      "//third_party/blink/web_tests/ppapi/",
      "//third_party/blink/web_tests/print_testharness/",
      "//third_party/blink/web_tests/printing/",
      "//third_party/blink/web_tests/register-protocol-handler/",
      "//third_party/blink/web_tests/regress/",
      "//third_party/blink/web_tests/resize-observer/",
      "//third_party/blink/web_tests/resources/",
      "//third_party/blink/web_tests/rootscroller/",
      "//third_party/blink/web_tests/screen_orientation/",
      "//third_party/blink/web_tests/scrollbars/",
      "//third_party/blink/web_tests/security/",
      "//third_party/blink/web_tests/handwriting/",
      "//third_party/blink/web_tests/shadow-dom/",
      "//third_party/blink/web_tests/storage/",
      "//third_party/blink/web_tests/svg/",
      "//third_party/blink/web_tests/synthetic_gestures/",
      "//third_party/blink/web_tests/tables/",
      "//third_party/blink/web_tests/test_runner/",
      "//third_party/blink/web_tests/third_party/",
      "//third_party/blink/web_tests/timezonechange/",
      "//third_party/blink/web_tests/touchadjustment/",
      "//third_party/blink/web_tests/transforms/",
      "//third_party/blink/web_tests/transitions/",
      "//third_party/blink/web_tests/traversal/",
      "//third_party/blink/web_tests/typedcssom/",
      "//third_party/blink/web_tests/vibration/",
      "//third_party/blink/web_tests/view-transition/",
      "//third_party/blink/web_tests/virtual/",
      "//third_party/blink/web_tests/virtualkeyboard/",
      "//third_party/blink/web_tests/wasm/",
      "//third_party/blink/web_tests/webaudio/",
      "//third_party/blink/web_tests/webexposed/",
      "//third_party/blink/web_tests/webgpu/",
      "//third_party/blink/web_tests/xmlviewer/",

      # === Test Case Folders Ends ===
    ]
  }

  group("blink_web_tests_expectations") {
    testonly = true

    data = [
      # Include virtual baselines.
      "//third_party/blink/web_tests/virtual/",

      # List all test expectations here
      "//third_party/blink/web_tests/LeakExpectations",
      "//third_party/blink/web_tests/NeverFixTests",
      "//third_party/blink/web_tests/SlowTests",
      "//third_party/blink/web_tests/StaleTestExpectations",
      "//third_party/blink/web_tests/TestExpectations",
    ]

    if (is_asan) {
      data += [ "//third_party/blink/web_tests/ASANExpectations" ]
    }
    if (is_msan) {
      data += [ "//third_party/blink/web_tests/MSANExpectations" ]
    }

    if (is_win || is_linux || is_fuchsia) {
      data += [
        "//third_party/blink/web_tests/platform/win/",
        "//third_party/blink/web_tests/platform/win10/",
        "//third_party/blink/web_tests/platform/win11-arm64/",
      ]
      if (is_linux || is_fuchsia) {
        data += [ "//third_party/blink/web_tests/platform/linux/" ]
      }
      if (is_fuchsia) {
        data += [
          "//third_party/blink/web_tests/platform/fuchsia/",
          "$root_gen_dir/package_metadata/content_shell.meta",
        ]
      }
    } else if (is_mac) {
      data += [
        "//third_party/blink/web_tests/platform/mac/",
        "//third_party/blink/web_tests/platform/mac-mac11/",
        "//third_party/blink/web_tests/platform/mac-mac11-arm64/",
        "//third_party/blink/web_tests/platform/mac-mac12/",
        "//third_party/blink/web_tests/platform/mac-mac12-arm64/",
        "//third_party/blink/web_tests/platform/mac-mac13/",
        "//third_party/blink/web_tests/platform/mac-mac13-arm64/",
        "//third_party/blink/web_tests/platform/mac-mac14/",
        "//third_party/blink/web_tests/platform/mac-mac14-arm64/",
        "//third_party/blink/web_tests/platform/mac-mac15-arm64/",
      ]
    }

    # flag-specific tests only runs on linux & mac as of now
    if (is_linux || is_mac) {
      data += [
        "//third_party/blink/web_tests/FlagSpecificConfig",
        "//third_party/blink/web_tests/FlagExpectations/",
        "//third_party/blink/web_tests/flag-specific/",
      ]
    }
  }

  script_test("blink_wpt_tests") {
    script = _common_web_test_script

    args = _common_web_test_args

    # Use --wpt-only to skip tests under web_tests/virtual/
    args += [
      "--wpt-only",
      "--inverted-test-launcher-filter-file",
      "@WrappedPath(" +
          rebase_path("//third_party/blink/web_tests/TestLists/chrome.filter",
                      root_out_dir) + ")",
      "--inverted-test-launcher-filter-file",
      "@WrappedPath(" + rebase_path(
              "//third_party/blink/web_tests/TestLists/headless_shell.filter",
              root_out_dir) + ")",
    ]

    data_deps = [
      ":blink_web_tests_expectations",
      ":blink_web_tests_support_data",
    ]
    data = [
      "//third_party/blink/perf_tests/",
      "//third_party/blink/web_tests/VirtualTestSuites",

      # === List Test Cases folders here ===
      "//third_party/blink/web_tests/external/",
      "//third_party/blink/web_tests/wpt_internal/",

      # === Test Case Folders Ends ===
    ]
  }

  script_test("devtools_web_tests") {
    # This target differs from :blink_web_tests in that it uses the
    # same test harness but runs an entirely different set of tests
    # and doesn't have a dependency on the web_test directory at all.
    script = _common_web_test_script

    args = _common_web_test_args + [
             "--layout-tests-directory=@WrappedPath(" + rebase_path(
                     "//third_party/devtools-frontend/src/test/webtests",
                     root_out_dir) + ")",
             "http/tests/devtools",
           ]

    data_deps = [ ":blink_web_tests_support_data" ]
    data = [ "//third_party/devtools-frontend/src/test/webtests/" ]
  }

  script_test("webgpu_blink_web_tests") {
    # This target differs from :blink_web_tests in that it uses the same
    # test harness and a few additional flags but, more importantly, only runs
    # the web_tests/wpt_internal/webgpu tests, so it doesn't have a data
    # dependency on the whole web_test directory.
    script = _common_web_test_script

    args = _common_web_test_args
    if (is_asan) {
      args += [ "--timeout-ms=30000" ]
    }
    args += [
      "--ignore-default-expectations",
      "--additional-expectations",
      "@WrappedPath(../../third_party/blink/web_tests/WebGPUExpectations)",
      "--isolated-script-test-filter=wpt_internal/webgpu/*",
    ]

    data_deps = [
      ":blink_web_tests_support_data",
      "//third_party/webgpu-cts",
    ]
    data = [
      "//third_party/blink/web_tests/external/wpt/common/",
      "//third_party/blink/web_tests/external/wpt/resources/",
      "//third_party/blink/web_tests/FlagSpecificConfig",
      "//third_party/blink/web_tests/VirtualTestSuites",
      "//third_party/blink/web_tests/WebGPUExpectations",
      "//third_party/blink/web_tests/wpt_internal/",
      "//third_party/webgpu-cts/scripts/",
    ]
  }

  copy("layout_test_data_mojo_bindings") {
    testonly = true

    sources = [ "$root_gen_dir/mojo/public/js/mojo_bindings.js" ]

    outputs =
        [ "$root_gen_dir/layout_test_data/mojo/public/js/mojo_bindings.js" ]

    deps = [ "//mojo/public/js:bindings" ]
  }

  copy("layout_test_data_mojo_bindings_lite") {
    testonly = true

    sources = [ "$root_gen_dir/mojo/public/js/mojo_bindings_lite.js" ]

    outputs = [
      "$root_gen_dir/layout_test_data/mojo/public/js/mojo_bindings_lite.js",
    ]

    deps = [ "//mojo/public/js:bindings_lite" ]
  }

  script_test("blink_python_tests") {
    script = "//testing/scripts/run_isolated_script_test.py"
    args = [
      "@WrappedPath(" +
          rebase_path("//third_party/blink/tools/run_blinkpy_tests.py",
                      root_build_dir) + ")",
      "-v",
      "-t",
    ]

    data = [
      # These tests use //build/android/devil_chromium.py even when !is_android,
      # so cannot use the helpers in //build/android (they assert(is_android)).
      "//build/android/",
      "//build/gn_helpers.py",
      "//build/config/gclient_args.gni",
      "//build/skia_gold_common/",
      "//components/crash/content/tools/generate_breakpad_symbols.py",
      "//testing/unexpected_passes_common/",
      "//testing/flake_suppressor_common/",
      "//third_party/blink/renderer/bindings/scripts/",
      "//third_party/blink/renderer/build/scripts/",
      "//third_party/blink/tools/",
      "//third_party/blink/web_tests/ASANExpectations",
      "//third_party/blink/web_tests/FlagExpectations/",
      "//third_party/blink/web_tests/LeakExpectations",
      "//third_party/blink/web_tests/MSANExpectations",
      "//third_party/blink/web_tests/NeverFixTests",
      "//third_party/blink/web_tests/SlowTests",
      "//third_party/blink/web_tests/StaleTestExpectations",
      "//third_party/blink/web_tests/TestExpectations",
      "//third_party/blink/web_tests/VirtualTestSuites",
      "//third_party/blink/web_tests/W3CImportExpectations",
      "//third_party/blink/web_tests/paint/invalidation/repaint-overlay/",
      "//third_party/catapult/common/py_utils/",
      "//third_party/catapult/devil/",
      "//third_party/catapult/dependency_manager/",
      "//third_party/catapult/third_party/typ/",
      "//third_party/depot_tools/pylint-2.7",
      "//third_party/depot_tools/pylint_main.py",
      "//third_party/depot_tools/pylintrc",
      "//third_party/ply/",
      "//third_party/pyjson5/",
      "//third_party/wpt_tools/",
      "//tools/idl_parser/",
    ]

    if (is_ios) {
      data += [ "//third_party/blink/web_tests/IOSTestExpectations" ]
    }

    data_deps = [ "//ui/base:goldctl" ]
  }
}

# TODO(cassew): Add more OS's that don't support x86.
is_valid_x86_target =
    target_os != "ios" && target_os != "mac" &&
    (target_os != "linux" || use_libfuzzer || !build_with_chromium)

# Note: v8_target_cpu == arm allows using the V8 arm simulator on x86 for fuzzing.
assert(
    is_valid_x86_target || target_cpu != "x86" || v8_target_cpu == "arm",
    "'target_cpu=x86' is not supported for 'target_os=$target_os'. Consider omitting 'target_cpu' (default) or using 'target_cpu=x64' instead.")

group("chromium_builder_perf") {
  testonly = true

  if (!is_ios && !is_android && !is_castos && !is_cronet_build) {
    data_deps = [
      "//components/tracing:tracing_perftests",
      "//gpu:command_buffer_perftests",
      "//gpu:gpu_perftests",
      "//media:media_perftests",
      "//tools/perf/chrome_telemetry_build:telemetry_chrome_test",
    ]

    if (!is_fuchsia) {
      data_deps += [
        "//chrome/test:load_library_perf_tests",
        "//chrome/test:performance_test_suite",
      ]
    }

    if (!is_chromeos_ash && !is_fuchsia) {
      data_deps += [ "//chrome/test:performance_browser_tests" ]
    }

    if (!is_win) {
      data_deps += [ "//third_party/breakpad:minidump_stackwalk($host_system_allocator_toolchain)" ]
    }
  }

  if ((is_linux && !is_castos) || is_chromeos_lacros) {
    if (is_official_build) {
      # In GN builds, this is controlled by the 'linux_dump_symbols'
      # flag, which defaults to 1 for official builds. For now,
      # we skip the separate flag and just key off of is_official_build.
      data_deps += [ "//chrome:linux_symbols" ]
    }

    data_deps += [ "//tools/perf/clear_system_cache" ]
  }

  if (is_win) {
    data_deps += [
      "//chrome/installer/mini_installer:mini_installer",
      "//components:components_perftests",
      "//third_party/angle/src/tests:angle_perftests",
    ]
  }
}

if (!is_ios && !is_android && !is_castos && !is_cronet_build) {
  group("chromium_builder_asan") {
    testonly = true

    deps = [
      "//content/shell:content_shell",
      "//third_party/blink/public/mojom:mojom_modules_js",
      "//v8:d8",
    ]
    if (!is_fuchsia) {
      deps += [ "//chrome:chrome" ]
    }
    if (!is_win) {
      deps += [ "//skia:filter_fuzz_stub" ]
    }
    if (enable_ipc_fuzzer && !is_component_build) {
      deps += [ "//tools/ipc_fuzzer:ipc_fuzzer_all" ]
    }
    if (!is_chromeos_ash) {
      deps += [ "//v8:v8_shell($v8_snapshot_toolchain)" ]
      if (enable_pdf) {
        deps += [ "//third_party/pdfium/testing:pdfium_test" ]
      }
    }

    if (!is_component_build) {
      # See https://bugs.chromium.org/p/chromium/issues/detail?id=942546#c11.
      deps += [
        "//third_party/webrtc/rtc_tools:rtp_generator",
        "//third_party/webrtc/rtc_tools:video_replay",
      ]
    }

    if (build_dawn_tests) {
      deps += [ "//third_party/dawn/src/tint:fuzzers" ]
    }
  }
}

if (is_android && !is_cronet_build) {
  group("optimize_gn_gen") {
    deps = [
      # These run expensive scripts in non-default toolchains. Generally, host
      # toolchain targets are loaded in the later part of the run, and the
      # result is they push out the end of generation. By preloading these, the
      # scripts can be parallelized with the rest of the load.
      "//build/config/linux(//build/toolchain/linux:clang_x64)",
      "//build/config/posix(//build/toolchain/linux:clang_x64)",

      # Include x86 toolchains as well since V8 uses them for 32-bit snapshot
      # generation.
      "//build/config/linux(//build/toolchain/linux:clang_x86)",
      "//build/config/posix(//build/toolchain/linux:clang_x86)",
    ]
  }
}

if (is_chromeos_ash && enable_js_type_check) {
  group("webui_closure_compile") {
    testonly = true
    data_deps = [
      "ash/webui:closure_compile",
      "chrome/browser/resources:closure_compile",
      "chrome/test/data/webui:closure_compile",
      "mojo/public/tools/bindings/generators/js_templates/lite/test:closure_compile",
      "mojo/public/tools/bindings/generators/js_templates/lite/test:closure_compile_modules",
    ]
  }
}

# Write debug logs to gn_logs.txt.
_lines = [
           "Generated during 'gn gen' by //BUILD.gn.",
           "",
         ] + build_gn_logs

# GN evaluates each .gn file once per toolchain, so restricting to default
# toolchain will ensure write_file() is called only once.
assert(current_toolchain == default_toolchain)

write_file("$root_build_dir/gn_logs.txt", _lines)