Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: headless/BUILD.gn

Issue 2902583002: Add some closureised JS bindings for DevTools for use by headless embedder (Closed)
Patch Set: Fix the test after rebasing Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 "test/test_harness.js",
525 ]
526 deps = [
527 ":js_devtools_bindings_lib",
528 ]
529 extra_deps = []
530 externs_list = [ "lib/tab_socket_externs.js" ]
531 outputs = [
532 "$target_gen_dir/devtools_bindings_test.js",
533 ]
534 config_files = []
535 closure_flags = [
536 "jscomp_error=checkTypes",
537 "dependency_mode=STRICT",
538
539 # Currently the bindings do not support property renaming so we can't use
540 # ADVANCED_OPTIMIZATIONS here. We could add support via either moving all
541 # the types to externs, or via applying the same renaming to the json
542 # dictionaries sent between C++ and JS. The closure compiler can produce
543 # files which contain those mappings with the appropriate flag.
544 "compilation_level=SIMPLE",
545 "language_out=ES5_STRICT",
546 "entry_point=goog.DevTools.BindingsTest",
547 ]
548 }
549
550 grit("headless_browsertest_resources_grit") {
551 source = "headless_browsertest_resources.grd"
552 outputs = [
553 "grit/headless_browsertest_resources.h",
554 "$root_gen_dir/headless/headless_browsertest_resources.pak",
555 ]
556 grit_flags = [
557 "-E",
558 "gen_root=" + rebase_path(root_gen_dir),
559 ]
560 deps = [
561 ":js_devtools_bindings_test",
562 ]
563 resource_ids = "lib/headless_browsertest_resource_ids"
564 }
565
566 repack("headless_browser_tests_pak") {
567 sources = [
568 "$root_gen_dir/headless/headless_browsertest_resources.pak",
569 ]
570 output = "$root_out_dir/headless_browser_tests.pak"
571 deps = [
572 ":headless_browsertest_resources_grit",
573 ]
574 }
575 }
576
508 test("headless_browsertests") { 577 test("headless_browsertests") {
509 sources = [ 578 sources = [
510 "lib/frame_id_browsertest.cc", 579 "lib/frame_id_browsertest.cc",
511 "lib/headless_browser_browsertest.cc", 580 "lib/headless_browser_browsertest.cc",
512 "lib/headless_browser_context_browsertest.cc", 581 "lib/headless_browser_context_browsertest.cc",
513 "lib/headless_devtools_client_browsertest.cc", 582 "lib/headless_devtools_client_browsertest.cc",
514 "lib/headless_web_contents_browsertest.cc", 583 "lib/headless_web_contents_browsertest.cc",
515 "public/util/dom_tree_extractor_browsertest.cc", 584 "public/util/dom_tree_extractor_browsertest.cc",
516 "public/util/flat_dom_tree_extractor_browsertest.cc", 585 "public/util/flat_dom_tree_extractor_browsertest.cc",
517 "test/headless_browser_test.cc", 586 "test/headless_browser_test.cc",
518 "test/headless_browser_test.h", 587 "test/headless_browser_test.h",
519 "test/headless_test_launcher.cc", 588 "test/headless_test_launcher.cc",
520 "test/test_protocol_handler.cc", 589 "test/test_protocol_handler.cc",
521 "test/test_protocol_handler.h", 590 "test/test_protocol_handler.h",
522 "test/test_url_request_job.cc", 591 "test/test_url_request_job.cc",
523 "test/test_url_request_job.h", 592 "test/test_url_request_job.h",
524 ] 593 ]
525 594
526 data = [ 595 data = [
596 "$root_out_dir/headless_browser_tests.pak",
527 "$root_out_dir/headless_lib.pak", 597 "$root_out_dir/headless_lib.pak",
528 "//net/tools/testserver/", 598 "//net/tools/testserver/",
529 "//third_party/pyftpdlib/", 599 "//third_party/pyftpdlib/",
530 "//third_party/pywebsocket/", 600 "//third_party/pywebsocket/",
531 "//third_party/skia/", 601 "//third_party/skia/",
532 "//third_party/tlslite/", 602 "//third_party/tlslite/",
533 "test/data/", 603 "test/data/",
534 ] 604 ]
535 605
536 if (is_mac) { 606 if (is_mac) {
537 data_deps = [ ":mac_helpers" ] 607 data_deps = [
608 ":mac_helpers",
609 ]
538 } 610 }
539 611
540 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] 612 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
541 613
542 if (!is_component_build) { 614 if (!is_component_build) {
543 sources += [ 615 sources += [
544 "lib/browser/headless_content_browser_client.cc", 616 "lib/browser/headless_content_browser_client.cc",
545 "lib/browser/headless_content_browser_client.h", 617 "lib/browser/headless_content_browser_client.h",
546 ] 618 ]
547 } 619 }
548 620
549 deps = [ 621 deps = [
550 ":headless_renderer", 622 ":headless_renderer",
551 "//base", 623 "//base",
552 "//components/crash/content/browser", 624 "//components/crash/content/browser",
553 "//components/security_state/content", 625 "//components/security_state/content",
554 "//content/test:test_support", 626 "//content/test:test_support",
555 "//testing/gmock", 627 "//testing/gmock",
556 "//testing/gtest", 628 "//testing/gtest",
557 ] 629 ]
558 630
631 # The js_binary rule doesn't currently work on windows.
632 if (!is_win) {
633 sources += [ "test/headless_js_bindings_browsertest.cc" ]
634 deps += [ ":headless_browser_tests_pak" ]
635 }
636
559 if (enable_basic_printing) { 637 if (enable_basic_printing) {
560 deps += [ 638 deps += [
561 "//components/printing/browser", 639 "//components/printing/browser",
562 "//pdf", 640 "//pdf",
563 ] 641 ]
564 } 642 }
565 } 643 }
566 644
567 if (is_win) { 645 if (is_win) {
568 # Headless library with only browser dependencies. This is used when no child 646 # Headless library with only browser dependencies. This is used when no child
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 786
709 executable("headless_example") { 787 executable("headless_example") {
710 sources = [ 788 sources = [
711 "app/headless_example.cc", 789 "app/headless_example.cc",
712 ] 790 ]
713 791
714 deps = [ 792 deps = [
715 ":headless_shell_lib", 793 ":headless_shell_lib",
716 ] 794 ]
717 } 795 }
OLDNEW
« no previous file with comments | « no previous file | headless/headless_browsertest_resources.grd » ('j') | headless/test/headless_js_bindings_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698