OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/util/process_version.gni") | 6 import("//build/util/process_version.gni") |
7 import("//headless/headless.gni") | 7 import("//headless/headless.gni") |
8 import("//mojo/public/tools/bindings/mojom.gni") | 8 import("//mojo/public/tools/bindings/mojom.gni") |
9 import("//printing/features/features.gni") | 9 import("//printing/features/features.gni") |
10 import("//testing/test.gni") | 10 import("//testing/test.gni") |
| 11 import("//third_party/closure_compiler/compile_js.gni") |
11 import("//tools/grit/grit_rule.gni") | 12 import("//tools/grit/grit_rule.gni") |
12 import("//tools/grit/repack.gni") | 13 import("//tools/grit/repack.gni") |
13 | 14 |
14 config("headless_implementation") { | 15 config("headless_implementation") { |
15 defines = [ "HEADLESS_IMPLEMENTATION" ] | 16 defines = [ "HEADLESS_IMPLEMENTATION" ] |
16 | 17 |
17 if (headless_use_embedded_resources) { | 18 if (headless_use_embedded_resources) { |
18 defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ] | 19 defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ] |
19 } | 20 } |
20 } | 21 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 "page", | 154 "page", |
154 "profiler", | 155 "profiler", |
155 "runtime", | 156 "runtime", |
156 "security", | 157 "security", |
157 "service_worker", | 158 "service_worker", |
158 "target", | 159 "target", |
159 "tracing", | 160 "tracing", |
160 ] | 161 ] |
161 | 162 |
162 generated_devtools_api = [] | 163 generated_devtools_api = [] |
| 164 generated_devtools_api_js = [] |
163 foreach(domain, devtools_domains) { | 165 foreach(domain, devtools_domains) { |
| 166 generated_devtools_api_js += |
| 167 [ "$target_gen_dir/public/devtools_js/" + domain + ".js" ] |
164 generated_devtools_api += [ | 168 generated_devtools_api += [ |
165 "$target_gen_dir/public/devtools/domains/" + domain + ".cc", | 169 "$target_gen_dir/public/devtools/domains/" + domain + ".cc", |
166 "$target_gen_dir/public/devtools/domains/" + domain + ".h", | 170 "$target_gen_dir/public/devtools/domains/" + domain + ".h", |
167 "$target_gen_dir/public/devtools/domains/types_" + domain + ".h", | 171 "$target_gen_dir/public/devtools/domains/types_" + domain + ".h", |
168 "$target_gen_dir/public/devtools/domains/types_" + domain + ".cc", | 172 "$target_gen_dir/public/devtools/domains/types_" + domain + ".cc", |
169 "$target_gen_dir/public/devtools/internal/type_conversions_" + domain + | 173 "$target_gen_dir/public/devtools/internal/type_conversions_" + domain + |
170 ".h", | 174 ".h", |
171 "$target_gen_dir/public/devtools/internal/" + | 175 "$target_gen_dir/public/devtools/internal/" + |
172 "types_forward_declarations_" + domain + ".h", | 176 "types_forward_declarations_" + domain + ".h", |
173 ] | 177 ] |
174 } | 178 } |
175 | 179 |
176 action("gen_devtools_client_api") { | 180 action("gen_devtools_client_api") { |
177 script = "lib/browser/devtools_api/client_api_generator.py" | 181 script = "lib/browser/devtools_api/client_api_generator.py" |
178 deps = [ | 182 deps = [ |
179 "//third_party/WebKit/Source/core/inspector:protocol_version", | 183 "//third_party/WebKit/Source/core/inspector:protocol_version", |
180 ] | 184 ] |
181 inputs = [ | 185 inputs = [ |
182 "$root_gen_dir/blink/core/inspector/protocol.json", | 186 "$root_gen_dir/blink/core/inspector/protocol.json", |
183 ] | 187 ] |
184 | 188 |
185 outputs = generated_devtools_api | 189 outputs = generated_devtools_api + generated_devtools_api_js |
186 | 190 |
187 sources = [ | 191 sources = [ |
188 "lib/browser/devtools_api/domain_cc.template", | 192 "lib/browser/devtools_api/domain_cc.template", |
189 "lib/browser/devtools_api/domain_h.template", | 193 "lib/browser/devtools_api/domain_h.template", |
| 194 "lib/browser/devtools_api/domain_js.template", |
190 "lib/browser/devtools_api/domain_type_conversions_h.template", | 195 "lib/browser/devtools_api/domain_type_conversions_h.template", |
191 "lib/browser/devtools_api/domain_types_cc.template", | 196 "lib/browser/devtools_api/domain_types_cc.template", |
192 "lib/browser/devtools_api/domain_types_forward_declarations_h.template", | 197 "lib/browser/devtools_api/domain_types_forward_declarations_h.template", |
193 "lib/browser/devtools_api/domain_types_h.template", | 198 "lib/browser/devtools_api/domain_types_h.template", |
194 ] | 199 ] |
195 | 200 |
196 args = [ | 201 args = [ |
197 "--protocol", | 202 "--protocol", |
198 rebase_path(inputs[0], root_build_dir), | 203 rebase_path(inputs[0], root_build_dir), |
199 "--output_dir", | 204 "--output_dir", |
200 rebase_path(target_gen_dir) + "/public", | 205 rebase_path(target_gen_dir) + "/public", |
201 ] | 206 ] |
202 } | 207 } |
203 | 208 |
| 209 js_library("js_devtools_bindings_lib") { |
| 210 sources = [ "lib/browser/devtools_api/devtools_connection.js" ] + |
| 211 generated_devtools_api_js |
| 212 deps = [] |
| 213 extra_deps = [ ":gen_devtools_client_api" ] |
| 214 } |
| 215 |
204 if (headless_fontconfig_utils) { | 216 if (headless_fontconfig_utils) { |
205 static_library("headless_fontconfig_utils") { | 217 static_library("headless_fontconfig_utils") { |
206 sources = [ | 218 sources = [ |
207 "public/util/fontconfig.cc", | 219 "public/util/fontconfig.cc", |
208 "public/util/fontconfig.h", | 220 "public/util/fontconfig.h", |
209 ] | 221 ] |
210 | 222 |
211 deps = [ | 223 deps = [ |
212 "//third_party/fontconfig", | 224 "//third_party/fontconfig", |
213 "//third_party/freetype", | 225 "//third_party/freetype", |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 "//base", | 510 "//base", |
499 "//third_party/crashpad/crashpad/handler:crashpad_handler", | 511 "//third_party/crashpad/crashpad/handler:crashpad_handler", |
500 ] | 512 ] |
501 | 513 |
502 outputs = [ | 514 outputs = [ |
503 "$root_out_dir/Helpers/{{source_file_part}}", | 515 "$root_out_dir/Helpers/{{source_file_part}}", |
504 ] | 516 ] |
505 } | 517 } |
506 } | 518 } |
507 | 519 |
| 520 if (!is_win) { |
| 521 js_binary("js_devtools_bindings_test") { |
| 522 sources = [ |
| 523 "test/bindings_test.js", |
| 524 ] |
| 525 deps = [ |
| 526 ":js_devtools_bindings_lib", |
| 527 ] |
| 528 extra_deps = [] |
| 529 externs_list = [ "lib/tab_socket_externs.js" ] |
| 530 outputs = [ |
| 531 "$target_gen_dir/devtools_bindings_test.js", |
| 532 ] |
| 533 config_files = [] |
| 534 closure_flags = [ |
| 535 "jscomp_error=checkTypes", |
| 536 "dependency_mode=STRICT", |
| 537 |
| 538 # Currently the bindings do not support property renaming so we can't use |
| 539 # ADVANCED_OPTIMIZATIONS here. We could add support via either moving all |
| 540 # the types to externs, or via applying the same renaming to the json |
| 541 # dictionaries sent between C++ and JS. The closure compiler can produce |
| 542 # files which contain those mappings with the appropriate flag. |
| 543 "compilation_level=SIMPLE", |
| 544 "language_out=ES5_STRICT", |
| 545 "entry_point=chromium.BindingsTest", |
| 546 ] |
| 547 } |
| 548 |
| 549 grit("headless_browsertest_resources_grit") { |
| 550 source = "headless_browsertest_resources.grd" |
| 551 outputs = [ |
| 552 "grit/headless_browsertest_resources.h", |
| 553 "$root_gen_dir/headless/headless_browsertest_resources.pak", |
| 554 ] |
| 555 grit_flags = [ |
| 556 "-E", |
| 557 "gen_root=" + rebase_path(root_gen_dir), |
| 558 ] |
| 559 deps = [ |
| 560 ":js_devtools_bindings_test", |
| 561 ] |
| 562 resource_ids = "lib/headless_browsertest_resource_ids" |
| 563 } |
| 564 |
| 565 repack("headless_browser_tests_pak") { |
| 566 sources = [ |
| 567 "$root_gen_dir/headless/headless_browsertest_resources.pak", |
| 568 ] |
| 569 output = "$root_out_dir/headless_browser_tests.pak" |
| 570 deps = [ |
| 571 ":headless_browsertest_resources_grit", |
| 572 ] |
| 573 } |
| 574 } |
| 575 |
508 test("headless_browsertests") { | 576 test("headless_browsertests") { |
509 sources = [ | 577 sources = [ |
510 "lib/frame_id_browsertest.cc", | 578 "lib/frame_id_browsertest.cc", |
511 "lib/headless_browser_browsertest.cc", | 579 "lib/headless_browser_browsertest.cc", |
512 "lib/headless_browser_context_browsertest.cc", | 580 "lib/headless_browser_context_browsertest.cc", |
513 "lib/headless_devtools_client_browsertest.cc", | 581 "lib/headless_devtools_client_browsertest.cc", |
514 "lib/headless_web_contents_browsertest.cc", | 582 "lib/headless_web_contents_browsertest.cc", |
515 "public/util/dom_tree_extractor_browsertest.cc", | 583 "public/util/dom_tree_extractor_browsertest.cc", |
516 "public/util/flat_dom_tree_extractor_browsertest.cc", | 584 "public/util/flat_dom_tree_extractor_browsertest.cc", |
517 "test/headless_browser_test.cc", | 585 "test/headless_browser_test.cc", |
518 "test/headless_browser_test.h", | 586 "test/headless_browser_test.h", |
519 "test/headless_test_launcher.cc", | 587 "test/headless_test_launcher.cc", |
520 "test/test_protocol_handler.cc", | 588 "test/test_protocol_handler.cc", |
521 "test/test_protocol_handler.h", | 589 "test/test_protocol_handler.h", |
522 "test/test_url_request_job.cc", | 590 "test/test_url_request_job.cc", |
523 "test/test_url_request_job.h", | 591 "test/test_url_request_job.h", |
524 ] | 592 ] |
525 | 593 |
526 data = [ | 594 data = [ |
| 595 "$root_out_dir/headless_browser_tests.pak", |
527 "$root_out_dir/headless_lib.pak", | 596 "$root_out_dir/headless_lib.pak", |
528 "//net/tools/testserver/", | 597 "//net/tools/testserver/", |
529 "//third_party/pyftpdlib/", | 598 "//third_party/pyftpdlib/", |
530 "//third_party/pywebsocket/", | 599 "//third_party/pywebsocket/", |
531 "//third_party/skia/", | 600 "//third_party/skia/", |
532 "//third_party/tlslite/", | 601 "//third_party/tlslite/", |
533 "test/data/", | 602 "test/data/", |
534 ] | 603 ] |
535 | 604 |
536 if (is_mac) { | 605 if (is_mac) { |
537 data_deps = [ ":mac_helpers" ] | 606 data_deps = [ |
| 607 ":mac_helpers", |
| 608 ] |
538 } | 609 } |
539 | 610 |
540 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] | 611 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
541 | 612 |
542 if (!is_component_build) { | 613 if (!is_component_build) { |
543 sources += [ | 614 sources += [ |
544 "lib/browser/headless_content_browser_client.cc", | 615 "lib/browser/headless_content_browser_client.cc", |
545 "lib/browser/headless_content_browser_client.h", | 616 "lib/browser/headless_content_browser_client.h", |
546 ] | 617 ] |
547 } | 618 } |
548 | 619 |
549 deps = [ | 620 deps = [ |
550 ":headless_renderer", | 621 ":headless_renderer", |
551 "//base", | 622 "//base", |
552 "//components/crash/content/browser", | 623 "//components/crash/content/browser", |
553 "//components/security_state/content", | 624 "//components/security_state/content", |
554 "//content/test:test_support", | 625 "//content/test:test_support", |
555 "//testing/gmock", | 626 "//testing/gmock", |
556 "//testing/gtest", | 627 "//testing/gtest", |
557 ] | 628 ] |
558 | 629 |
| 630 # The js_binary rule doesn't currently work on windows. |
| 631 if (!is_win) { |
| 632 sources += [ "test/headless_js_bindings_browsertest.cc" ] |
| 633 deps += [ ":headless_browser_tests_pak" ] |
| 634 } |
| 635 |
559 if (enable_basic_printing) { | 636 if (enable_basic_printing) { |
560 deps += [ | 637 deps += [ |
561 "//components/printing/browser", | 638 "//components/printing/browser", |
562 "//pdf", | 639 "//pdf", |
563 ] | 640 ] |
564 } | 641 } |
565 } | 642 } |
566 | 643 |
567 if (is_win) { | 644 if (is_win) { |
568 # Headless library with only browser dependencies. This is used when no child | 645 # Headless library with only browser dependencies. This is used when no child |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 785 |
709 executable("headless_example") { | 786 executable("headless_example") { |
710 sources = [ | 787 sources = [ |
711 "app/headless_example.cc", | 788 "app/headless_example.cc", |
712 ] | 789 ] |
713 | 790 |
714 deps = [ | 791 deps = [ |
715 ":headless_shell_lib", | 792 ":headless_shell_lib", |
716 ] | 793 ] |
717 } | 794 } |
OLD | NEW |