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

Side by Side Diff: headless/BUILD.gn

Issue 2902583002: Add some closureised JS bindings for DevTools for use by headless embedder (Closed)
Patch Set: Don't run the test on windows because js_binary doesn't work 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 "page", 153 "page",
153 "profiler", 154 "profiler",
154 "runtime", 155 "runtime",
155 "security", 156 "security",
156 "service_worker", 157 "service_worker",
157 "target", 158 "target",
158 "tracing", 159 "tracing",
159 ] 160 ]
160 161
161 generated_devtools_api = [] 162 generated_devtools_api = []
163 generated_devtools_api_js = []
162 foreach(domain, devtools_domains) { 164 foreach(domain, devtools_domains) {
165 generated_devtools_api_js +=
166 [ "$target_gen_dir/public/devtools/domains/" + domain + ".js" ]
Sami 2017/05/24 09:16:21 Could we put these in //headless/public/devtools_j
alex clarke (OOO till 29th) 2017/05/24 11:38:14 They need to be in the gen directory right? I can
163 generated_devtools_api += [ 167 generated_devtools_api += [
164 "$target_gen_dir/public/devtools/domains/" + domain + ".cc", 168 "$target_gen_dir/public/devtools/domains/" + domain + ".cc",
165 "$target_gen_dir/public/devtools/domains/" + domain + ".h", 169 "$target_gen_dir/public/devtools/domains/" + domain + ".h",
166 "$target_gen_dir/public/devtools/domains/types_" + domain + ".h", 170 "$target_gen_dir/public/devtools/domains/types_" + domain + ".h",
167 "$target_gen_dir/public/devtools/domains/types_" + domain + ".cc", 171 "$target_gen_dir/public/devtools/domains/types_" + domain + ".cc",
168 "$target_gen_dir/public/devtools/internal/type_conversions_" + domain + 172 "$target_gen_dir/public/devtools/internal/type_conversions_" + domain +
169 ".h", 173 ".h",
170 "$target_gen_dir/public/devtools/internal/" + 174 "$target_gen_dir/public/devtools/internal/" +
171 "types_forward_declarations_" + domain + ".h", 175 "types_forward_declarations_" + domain + ".h",
172 ] 176 ]
173 } 177 }
174 178
175 action("gen_devtools_client_api") { 179 action("gen_devtools_client_api") {
176 script = "lib/browser/devtools_api/client_api_generator.py" 180 script = "lib/browser/devtools_api/client_api_generator.py"
177 deps = [ 181 deps = [
178 "//third_party/WebKit/Source/core/inspector:protocol_version", 182 "//third_party/WebKit/Source/core/inspector:protocol_version",
179 ] 183 ]
180 inputs = [ 184 inputs = [
181 "$root_gen_dir/blink/core/inspector/protocol.json", 185 "$root_gen_dir/blink/core/inspector/protocol.json",
182 ] 186 ]
183 187
184 outputs = generated_devtools_api 188 outputs = generated_devtools_api + generated_devtools_api_js
185 189
186 sources = [ 190 sources = [
187 "lib/browser/devtools_api/domain_cc.template", 191 "lib/browser/devtools_api/domain_cc.template",
188 "lib/browser/devtools_api/domain_h.template", 192 "lib/browser/devtools_api/domain_h.template",
193 "lib/browser/devtools_api/domain_js.template",
189 "lib/browser/devtools_api/domain_type_conversions_h.template", 194 "lib/browser/devtools_api/domain_type_conversions_h.template",
190 "lib/browser/devtools_api/domain_types_cc.template", 195 "lib/browser/devtools_api/domain_types_cc.template",
191 "lib/browser/devtools_api/domain_types_forward_declarations_h.template", 196 "lib/browser/devtools_api/domain_types_forward_declarations_h.template",
192 "lib/browser/devtools_api/domain_types_h.template", 197 "lib/browser/devtools_api/domain_types_h.template",
193 ] 198 ]
194 199
195 args = [ 200 args = [
196 "--protocol", 201 "--protocol",
197 rebase_path(inputs[0], root_build_dir), 202 rebase_path(inputs[0], root_build_dir),
198 "--output_dir", 203 "--output_dir",
199 rebase_path(target_gen_dir) + "/public", 204 rebase_path(target_gen_dir) + "/public",
200 ] 205 ]
201 } 206 }
202 207
208 js_library("js_devtools_bindings_lib") {
209 sources = [ "lib/browser/devtools_api/devtools_connection.js" ] +
210 generated_devtools_api_js
211 deps = []
212 extra_deps = [ ":gen_devtools_client_api" ]
213 }
214
203 if (headless_fontconfig_utils) { 215 if (headless_fontconfig_utils) {
204 static_library("headless_fontconfig_utils") { 216 static_library("headless_fontconfig_utils") {
205 sources = [ 217 sources = [
206 "public/util/fontconfig.cc", 218 "public/util/fontconfig.cc",
207 "public/util/fontconfig.h", 219 "public/util/fontconfig.h",
208 ] 220 ]
209 221
210 deps = [ 222 deps = [
211 "//third_party/fontconfig", 223 "//third_party/fontconfig",
212 "//third_party/freetype", 224 "//third_party/freetype",
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 deps = [ 500 deps = [
489 "//third_party/crashpad/crashpad/handler:crashpad_handler", 501 "//third_party/crashpad/crashpad/handler:crashpad_handler",
490 ] 502 ]
491 503
492 outputs = [ 504 outputs = [
493 "$root_out_dir/Helpers/{{source_file_part}}", 505 "$root_out_dir/Helpers/{{source_file_part}}",
494 ] 506 ]
495 } 507 }
496 } 508 }
497 509
510 js_binary("js_devtools_bindings_test") {
511 sources = [
512 "test/bindings_test.js",
513 "test/test_harness.js",
514 ]
515 deps = [
516 ":js_devtools_bindings_lib",
517 ]
518 extra_deps = []
519 externs_list = [ "lib/tab_socket_externs.js" ]
520 outputs = [
521 "$target_gen_dir/devtools_bindings_test.js",
522 ]
523 config_files = []
524 closure_flags = [
525 "jscomp_error=checkTypes",
526 "dependency_mode=STRICT",
527
528 # Currently the bindings do not support property renaming so we can't use
529 # ADVANCED_OPTIMIZATIONS here. We could add support via either moving all
530 # the types to externs, or via applying the same renaming to the json
531 # dictionaries sent between C++ and JS. The closure compiler can produce
532 # files which contain those mappings with the appropriate flag.
533 "compilation_level=SIMPLE",
534 "language_out=ES5_STRICT",
535 "entry_point=goog.DevTools.BindingsTest",
536 "create_renaming_reports",
Sami 2017/05/24 09:16:21 Do we need the report if we don't do renaming?
alex clarke (OOO till 29th) 2017/05/24 11:38:14 Done.
537 ]
538 }
539
540 grit("headless_browsertest_resources_grit") {
541 source = "headless_browsertest_resources.grd"
542 outputs = [
543 "grit/headless_browsertest_resources.h",
544 "$root_gen_dir/headless/headless_browsertest_resources.pak",
545 ]
546 grit_flags = [
547 "-E",
548 "gen_root=" + rebase_path(root_gen_dir),
549 ]
550 deps = [
551 ":js_devtools_bindings_test",
552 ]
553 resource_ids = "lib/headless_browsertest_resource_ids"
554 }
555
556 repack("headless_browser_tests_pak") {
557 sources = [
558 "$root_gen_dir/headless/headless_browsertest_resources.pak",
559 ]
560 output = "$root_out_dir/headless_browser_tests.pak"
561 deps = [
562 ":headless_browsertest_resources_grit",
563 ]
564 }
565
498 test("headless_browsertests") { 566 test("headless_browsertests") {
499 sources = [ 567 sources = [
500 "lib/frame_id_browsertest.cc", 568 "lib/frame_id_browsertest.cc",
501 "lib/headless_browser_browsertest.cc", 569 "lib/headless_browser_browsertest.cc",
502 "lib/headless_browser_context_browsertest.cc", 570 "lib/headless_browser_context_browsertest.cc",
503 "lib/headless_devtools_client_browsertest.cc", 571 "lib/headless_devtools_client_browsertest.cc",
504 "lib/headless_web_contents_browsertest.cc", 572 "lib/headless_web_contents_browsertest.cc",
505 "public/util/dom_tree_extractor_browsertest.cc", 573 "public/util/dom_tree_extractor_browsertest.cc",
506 "public/util/flat_dom_tree_extractor_browsertest.cc", 574 "public/util/flat_dom_tree_extractor_browsertest.cc",
507 "test/headless_browser_test.cc", 575 "test/headless_browser_test.cc",
508 "test/headless_browser_test.h", 576 "test/headless_browser_test.h",
509 "test/headless_test_launcher.cc", 577 "test/headless_test_launcher.cc",
510 "test/test_protocol_handler.cc", 578 "test/test_protocol_handler.cc",
511 "test/test_protocol_handler.h", 579 "test/test_protocol_handler.h",
512 "test/test_url_request_job.cc", 580 "test/test_url_request_job.cc",
513 "test/test_url_request_job.h", 581 "test/test_url_request_job.h",
514 ] 582 ]
515 583
516 data = [ 584 data = [
585 "$root_out_dir/headless_browser_tests.pak",
517 "$root_out_dir/headless_lib.pak", 586 "$root_out_dir/headless_lib.pak",
518 "//net/tools/testserver/", 587 "//net/tools/testserver/",
519 "//third_party/pyftpdlib/", 588 "//third_party/pyftpdlib/",
520 "//third_party/pywebsocket/", 589 "//third_party/pywebsocket/",
521 "//third_party/skia/", 590 "//third_party/skia/",
522 "//third_party/tlslite/", 591 "//third_party/tlslite/",
523 "test/data/", 592 "test/data/",
524 ] 593 ]
525 594
526 if (is_mac) { 595 if (is_mac) {
(...skipping 12 matching lines...) Expand all
539 deps = [ 608 deps = [
540 ":headless_renderer", 609 ":headless_renderer",
541 "//base", 610 "//base",
542 "//components/crash/content/browser", 611 "//components/crash/content/browser",
543 "//components/security_state/content", 612 "//components/security_state/content",
544 "//content/test:test_support", 613 "//content/test:test_support",
545 "//testing/gmock", 614 "//testing/gmock",
546 "//testing/gtest", 615 "//testing/gtest",
547 ] 616 ]
548 617
618 # The js_binary rule doesn't currently work on windows.
619 if (!is_win) {
620 sources += [ "test/headless_js_bindings_browsertest.cc" ]
621 deps += [ ":headless_browser_tests_pak" ]
622 }
623
549 if (enable_basic_printing) { 624 if (enable_basic_printing) {
550 deps += [ 625 deps += [
551 "//components/printing/browser", 626 "//components/printing/browser",
552 "//pdf", 627 "//pdf",
553 ] 628 ]
554 } 629 }
555 } 630 }
556 631
557 if (is_win) { 632 if (is_win) {
558 # Headless library with only browser dependencies. This is used when no child 633 # Headless library with only browser dependencies. This is used when no child
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 772
698 executable("headless_example") { 773 executable("headless_example") {
699 sources = [ 774 sources = [
700 "app/headless_example.cc", 775 "app/headless_example.cc",
701 ] 776 ]
702 777
703 deps = [ 778 deps = [
704 ":headless_shell_lib", 779 ":headless_shell_lib",
705 ] 780 ]
706 } 781 }
OLDNEW
« no previous file with comments | « no previous file | headless/headless_browsertest_resources.grd » ('j') | headless/lib/browser/devtools_api/client_api_generator.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698