OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
6 import("//build/config/crypto.gni") | 6 import("//build/config/crypto.gni") |
7 import("//build/config/features.gni") | 7 import("//build/config/features.gni") |
8 import("//build/config/ui.gni") | 8 import("//build/config/ui.gni") |
9 import("//build/module_args/v8.gni") | 9 import("//build/module_args/v8.gni") |
10 import("//testing/test.gni") | 10 import("//testing/test.gni") |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 ] | 498 ] |
499 } | 499 } |
500 if (!is_chromeos) { | 500 if (!is_chromeos) { |
501 sources -= [ | 501 sources -= [ |
502 "../browser/sync/test/integration/wifi_credentials_helper.cc", | 502 "../browser/sync/test/integration/wifi_credentials_helper.cc", |
503 "../browser/sync/test/integration/wifi_credentials_helper.h", | 503 "../browser/sync/test/integration/wifi_credentials_helper.h", |
504 ] | 504 ] |
505 } | 505 } |
506 } | 506 } |
507 | 507 |
508 template("js2webui") { | 508 template("js2gtest") { |
| 509 assert(defined(invoker.test_type) && |
| 510 (invoker.test_type == "webui" || invoker.test_type == "unit")) |
509 action_name = target_name + "_action" | 511 action_name = target_name + "_action" |
510 source_set_name = target_name | 512 source_set_name = target_name |
511 | 513 |
512 action_foreach(action_name) { | 514 action_foreach(action_name) { |
513 testonly = true | 515 testonly = true |
514 visibility = [ ":$source_set_name" ] | 516 visibility = [ ":$source_set_name" ] |
515 script = "//tools/gypv8sh.py" | 517 script = "//tools/gypv8sh.py" |
516 | 518 |
517 sources = invoker.sources | 519 sources = invoker.sources |
518 | 520 |
519 d8_path = | 521 d8_path = |
520 get_label_info("//v8:d8($host_toolchain)", "root_out_dir") + "/d8" | 522 get_label_info("//v8:d8($host_toolchain)", "root_out_dir") + "/d8" |
521 if (is_win) { | 523 if (is_win) { |
522 d8_path += ".exe" | 524 d8_path += ".exe" |
523 } | 525 } |
524 | 526 |
525 input_js = [ | 527 input_js = [ |
526 "//chrome/third_party/mock4js/mock4js.js", | 528 "//chrome/third_party/mock4js/mock4js.js", |
527 "//chrome/test/data/webui/test_api.js", | 529 "//chrome/test/data/webui/test_api.js", |
528 "//chrome/test/base/js2gtest.js", | 530 "//chrome/test/base/js2gtest.js", |
529 ] | 531 ] |
530 inputs = [ d8_path ] + input_js | 532 inputs = [ d8_path ] + input_js |
531 | 533 |
532 outputs = [ | 534 outputs = [ |
533 "$target_gen_dir/{{source_name_part}}-gen.cc", | 535 "$target_gen_dir/{{source_name_part}}-gen.cc", |
534 "$root_out_dir/test_data/chrome/{{source_root_relative_dir}}/{{source_fi
le_part}}", | 536 "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part
}}", |
535 ] | 537 ] |
536 | 538 |
537 args = [ | 539 args = [ |
538 # Need "./" for script to find binary (cur dir is not on path). | 540 # Need "./" for script to find binary (cur dir is not on path). |
539 "./" + rebase_path(d8_path, root_build_dir), | 541 "./" + rebase_path(d8_path, root_build_dir), |
540 ] | 542 ] |
541 args += rebase_path(input_js, root_build_dir) + [ "webui" ] | 543 args += rebase_path(input_js, root_build_dir) + [ invoker.test_type ] |
542 if (v8_use_external_startup_data) { | 544 if (v8_use_external_startup_data) { |
543 args += [ "--external=y" ] | 545 args += [ "--external=y" ] |
544 } else { | 546 } else { |
545 args += [ "--external=n" ] | 547 args += [ "--external=n" ] |
546 } | 548 } |
547 args += [ | 549 args += [ |
548 "{{source}}", | 550 "{{source}}", |
549 "{{source_root_relative_dir}}/{{source_file_part}}", | 551 "{{source_root_relative_dir}}/{{source_file_part}}", |
550 ] | 552 ] |
551 args += rebase_path(outputs, root_build_dir) | 553 args += rebase_path(outputs, root_build_dir) |
552 | 554 |
553 deps = [ | 555 deps = [ |
554 "//v8:d8($host_toolchain)", | 556 "//v8:d8($host_toolchain)", |
555 ] | 557 ] |
556 } | 558 } |
557 | 559 |
| 560 if (defined(invoker.extra_js_files)) { |
| 561 copy_target_name = target_name + "_copy" |
| 562 copy(copy_target_name) { |
| 563 visibility = [ ":$source_set_name" ] |
| 564 sources = invoker.extra_js_files |
| 565 outputs = [ |
| 566 "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_pa
rt}}", |
| 567 ] |
| 568 } |
| 569 } |
558 source_set(source_set_name) { | 570 source_set(source_set_name) { |
559 testonly = true | 571 testonly = true |
560 if (defined(invoker.visibility)) { | 572 if (defined(invoker.visibility)) { |
561 visibility = invoker.visibility | 573 visibility = invoker.visibility |
562 } | 574 } |
563 sources = get_target_outputs(":$action_name") | 575 sources = get_target_outputs(":$action_name") |
564 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] | 576 if (defined(invoker.defines)) { |
| 577 defines = invoker.defines |
| 578 } |
565 deps = [ | 579 deps = [ |
566 ":$action_name", | 580 ":$action_name", |
567 | 581 |
568 # The generator implicitly makes includes from these targets. | 582 # The generator implicitly makes includes from these targets. |
569 "//testing/gmock", | 583 "//testing/gmock", |
570 "//testing/gtest", | 584 "//testing/gtest", |
571 "//url", | 585 "//url", |
572 ] | 586 ] |
573 if (defined(invoker.deps)) { | 587 if (defined(invoker.deps)) { |
574 deps += invoker.deps | 588 deps += invoker.deps |
575 } | 589 } |
| 590 if (defined(invoker.extra_js_files)) { |
| 591 data_deps = [ ":$copy_target_name" ] |
| 592 } |
576 } | 593 } |
577 } | 594 } |
578 | 595 |
579 js2webui("browser_tests_js_webui") { | 596 js2gtest("browser_tests_js_webui") { |
| 597 test_type = "webui" |
580 sources = rebase_path( | 598 sources = rebase_path( |
581 chrome_tests_gypi_values.chrome_browser_tests_webui_js_sources, | 599 chrome_tests_gypi_values.chrome_browser_tests_webui_js_sources, |
582 ".", | 600 ".", |
583 "//chrome") | 601 "//chrome") |
584 if (is_chrome_branded) { | 602 if (is_chrome_branded) { |
585 # crbug.com/230471 | 603 # crbug.com/230471 |
586 sources -= [ "data/webui/accessibility_audit_browsertest.js" ] | 604 sources -= [ "data/webui/accessibility_audit_browsertest.js" ] |
587 } | 605 } |
588 if (!is_chromeos) { | 606 if (!is_chromeos) { |
589 sources -= [ "data/webui/certificate_viewer_dialog_test.js" ] | 607 sources -= [ "data/webui/certificate_viewer_dialog_test.js" ] |
590 } | 608 } |
591 if (!enable_app_list) { | 609 if (!enable_app_list) { |
592 sources -= [ "../browser/ui/webui/app_list/start_page_browsertest.js" ] | 610 sources -= [ "../browser/ui/webui/app_list/start_page_browsertest.js" ] |
593 } | 611 } |
594 if (!enable_supervised_users) { | 612 if (!enable_supervised_users) { |
595 sources -= | 613 sources -= |
596 [ "../browser/ui/webui/downloads_ui_supervised_browsertest.js" ] | 614 [ "../browser/ui/webui/downloads_ui_supervised_browsertest.js" ] |
597 } | 615 } |
598 deps = [ | 616 deps = [ |
599 "//chrome/browser/ui", | 617 "//chrome/browser/ui", |
600 "//skia", | 618 "//skia", |
601 ] | 619 ] |
| 620 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
602 } | 621 } |
603 | 622 |
604 test("browser_tests") { | 623 test("browser_tests") { |
605 sources = [ | 624 sources = [ |
606 "base/browser_tests_main.cc", | 625 "base/browser_tests_main.cc", |
607 ] | 626 ] |
608 sources += | 627 sources += |
609 rebase_path(chrome_tests_gypi_values.chrome_browser_tests_sources, | 628 rebase_path(chrome_tests_gypi_values.chrome_browser_tests_sources, |
610 ".", | 629 ".", |
611 "//chrome") | 630 "//chrome") |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 "//third_party/widevine/cdm:widevinecdmadapter", | 1208 "//third_party/widevine/cdm:widevinecdmadapter", |
1190 ] | 1209 ] |
1191 } | 1210 } |
1192 } | 1211 } |
1193 | 1212 |
1194 unit_gypi_values = exec_script("//build/gypi_to_gn.py", | 1213 unit_gypi_values = exec_script("//build/gypi_to_gn.py", |
1195 [ rebase_path("../chrome_tests_unit.gypi") ], | 1214 [ rebase_path("../chrome_tests_unit.gypi") ], |
1196 "scope", | 1215 "scope", |
1197 [ "../chrome_tests_unit.gypi" ]) | 1216 [ "../chrome_tests_unit.gypi" ]) |
1198 | 1217 |
| 1218 js2gtest("unit_tests_js") { |
| 1219 test_type = "unit" |
| 1220 sources = rebase_path(unit_gypi_values.chrome_unit_tests_gtestjs_sources, |
| 1221 ".", |
| 1222 "//chrome") |
| 1223 extra_js_files = rebase_path(unit_gypi_values.chrome_unit_tests_js_sources, |
| 1224 ".", |
| 1225 "//chrome") |
| 1226 if (is_chromeos) { |
| 1227 sources += rebase_path( |
| 1228 unit_gypi_values.chrome_unit_tests_chromeos_gtestjs_sources, |
| 1229 ".", |
| 1230 "//chrome") |
| 1231 extra_js_files += |
| 1232 rebase_path(unit_gypi_values.chrome_unit_tests_chromeos_js_sources, |
| 1233 ".", |
| 1234 "//chrome") |
| 1235 } |
| 1236 } |
| 1237 |
1199 test("unit_tests") { | 1238 test("unit_tests") { |
1200 sources = | 1239 sources = |
1201 rebase_path(unit_gypi_values.chrome_unit_tests_sources, ".", "//chrome") | 1240 rebase_path(unit_gypi_values.chrome_unit_tests_sources, ".", "//chrome") |
1202 | 1241 |
1203 defines = [] | 1242 defines = [] |
1204 | 1243 |
1205 deps = [ | 1244 deps = [ |
1206 # NOTE: New depndencies should generally be added in the OS!="ios" | 1245 # NOTE: New depndencies should generally be added in the OS!="ios" |
1207 # dependencies block below, rather than here. | 1246 # dependencies block below, rather than here. |
1208 # Unit tests should only depend on: | 1247 # Unit tests should only depend on: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 "//ui/resources", | 1282 "//ui/resources", |
1244 ] | 1283 ] |
1245 data_deps = [] | 1284 data_deps = [] |
1246 | 1285 |
1247 # TODO(GYP) Windows stuff | 1286 # TODO(GYP) Windows stuff |
1248 # ['incremental_chrome_dll==1', { | 1287 # ['incremental_chrome_dll==1', { |
1249 # 'UseLibraryDependencyInputs': "true", | 1288 # 'UseLibraryDependencyInputs': "true", |
1250 | 1289 |
1251 if (!is_ios) { | 1290 if (!is_ios) { |
1252 deps += [ | 1291 deps += [ |
| 1292 ":unit_tests_js", |
1253 "//components/audio_modem:audio_modem_test_support", | 1293 "//components/audio_modem:audio_modem_test_support", |
1254 "//components/autofill/content/browser:test_support", | 1294 "//components/autofill/content/browser:test_support", |
1255 "//components/metrics/proto", | 1295 "//components/metrics/proto", |
1256 "//components/data_reduction_proxy/core/browser:test_support", | 1296 "//components/data_reduction_proxy/core/browser:test_support", |
1257 "//components/webdata_services:test_support", | 1297 "//components/webdata_services:test_support", |
1258 "//components/strings", | 1298 "//components/strings", |
1259 "//device/bluetooth:mocks", | 1299 "//device/bluetooth:mocks", |
1260 "//content/app/resources", | 1300 "//content/app/resources", |
1261 "//gpu:test_support", | 1301 "//gpu:test_support", |
1262 "//media:test_support", | 1302 "//media:test_support", |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 } | 1807 } |
1768 | 1808 |
1769 if (cld_version == 0 || cld_version == 2) { | 1809 if (cld_version == 0 || cld_version == 2) { |
1770 # Use whatever CLD2 data access mode that the | 1810 # Use whatever CLD2 data access mode that the |
1771 # application embedder is using. | 1811 # application embedder is using. |
1772 deps += [ "//third_party/cld_2:cld2_platform_impl" ] | 1812 deps += [ "//third_party/cld_2:cld2_platform_impl" ] |
1773 } | 1813 } |
1774 } | 1814 } |
1775 } | 1815 } |
1776 } | 1816 } |
OLD | NEW |