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

fuchsia_web / shell / BUILD.gn [blame]

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

assert(is_fuchsia)

import("//build/config/cast.gni")
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")

# Nothing else should depend on these targets except the final component.
visibility = [ ":*" ]

group("shell") {
  testonly = true
  visibility += [
    "//chrome/test:*",
    "//content/test:*",
    "//fuchsia_web:gn_all",
    "//fuchsia_web/av_testing:*",
  ]
  deps = [ ":web_engine_shell" ]

  if (enable_cast_receiver) {
    deps += [ ":cast_streaming_shell" ]
  }
}

source_set("remote_debugging_port") {
  sources = [
    "remote_debugging_port.cc",
    "remote_debugging_port.h",
  ]
  deps = [ "//base" ]
}

source_set("present_frame") {
  testonly = true
  sources = [
    "present_frame.cc",
    "present_frame.h",
  ]
  deps = [ "//base" ]
  public_deps = [
    "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.element",
    "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.web",
  ]
}

fuchsia_component("web_engine_shell_component") {
  testonly = true
  manifest = "web_engine_shell.cml"
  data_deps = [ ":web_engine_shell_exec" ]
}

# WebInstanceHost needs to serve capabilities to web_instance. Since the
# primary web_engine_shell component is a test component, it is not able to do
# this directly. Instead, it launches this here component to start instances via
# WebInstanceHost.
fuchsia_component("web_engine_shell_for_web_instance_host_component") {
  testonly = true
  manifest = "web_engine_shell_for_web_instance_host.cml"
  data_deps = [ ":web_engine_shell_exec" ]
}

fuchsia_package("web_engine_shell_pkg") {
  testonly = true

  # TODO(fxbug.dev/100944): Add appropriate visibility when fixed.
  package_name = "web_engine_shell"
  deps = [
    ":web_engine_shell_component",
    ":web_engine_shell_for_web_instance_host_component",
  ]
}

fuchsia_package_installer("web_engine_shell") {
  testonly = true
  package = ":web_engine_shell_pkg"
  package_name = "web_engine_shell"
  package_deps = [
    [
      "//fuchsia_web/webengine:web_engine",
      "web_engine",
    ],
    [
      "//fuchsia_web/webengine:web_engine_with_webui",
      "web_engine_with_webui",
    ],
  ]
}

executable("web_engine_shell_exec") {
  testonly = true
  sources = [ "web_engine_shell.cc" ]

  data = [ "data" ]

  deps = [
    ":present_frame",
    ":remote_debugging_port",
    ":shell_relauncher",
    "//base",
    "//components/fuchsia_component_support:annotations_manager",
    "//fuchsia_web/common",
    "//fuchsia_web/webinstance_host:webinstance_host",
    "//third_party/fuchsia-sdk/sdk/pkg/fdio",
    "//third_party/fuchsia-sdk/sdk/pkg/fidl_cpp",
    "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
    "//third_party/widevine/cdm:buildflags",
    "//url",
  ]
}

source_set("shell_relauncher") {
  testonly = true
  public = [ "shell_relauncher.h" ]
  sources = [ "shell_relauncher.cc" ]
  public_deps = [
    "//base",
    "//third_party/abseil-cpp:absl",
  ]
  deps = [
    "//fuchsia_web/common/test:test_support",
    "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.component:fuchsia.component_hlcpp",
    "//third_party/fuchsia-sdk/sdk/pkg/sys_component_cpp_testing",
  ]
}

if (enable_cast_receiver) {
  fuchsia_component("cast_streaming_shell_component") {
    testonly = true
    manifest = "cast_streaming_shell.cml"
    data_deps = [ ":cast_streaming_shell_exe" ]
  }

  # WebInstanceHost needs to serve capabilities to child components, which is
  # not possible when running inside a test component, such as
  # cast_streaming_shell. The shell therefore uses an intermediate component to
  # actually run the WebInstanceHost, from which the capabilities can be served.
  fuchsia_component("cast_streaming_shell_for_web_instance_host_component") {
    testonly = true
    manifest = "cast_streaming_shell_for_web_instance_host.cml"
    data_deps = [ ":cast_streaming_shell_exe" ]
  }

  fuchsia_package("cast_streaming_shell_pkg") {
    testonly = true
    package_name = "cast_streaming_shell"
    deps = [
      ":cast_streaming_shell_component",
      ":cast_streaming_shell_for_web_instance_host_component",
    ]
  }

  fuchsia_package_installer("cast_streaming_shell") {
    testonly = true
    package = ":cast_streaming_shell_pkg"
    package_name = "cast_streaming_shell"
    package_deps = [ [
          "//fuchsia_web/webengine:web_engine",
          "web_engine",
        ] ]
  }

  executable("cast_streaming_shell_exe") {
    testonly = true
    sources = [ "cast_streaming_shell.cc" ]

    data = [
      "cast_streaming_shell_data",
      rebase_path("//media/test/data/bear-1280x720.ivf"),
    ]

    deps = [
      ":present_frame",
      ":remote_debugging_port",
      ":shell_relauncher",
      "//base",
      "//base/test:test_support",
      "//components/cast/message_port:message_port",
      "//components/cast_streaming/test:test_sender_using_net_sockets",
      "//components/fuchsia_component_support:annotations_manager",
      "//fuchsia_web/cast_streaming",
      "//fuchsia_web/common",
      "//fuchsia_web/common/test:test_support",
      "//fuchsia_web/webengine:switches",
      "//fuchsia_web/webinstance_host:webinstance_host",
      "//media",
      "//media/gpu/test:test_helpers",
      "//third_party/fuchsia-sdk/sdk/pkg/fdio",
      "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
      "//url",
    ]
  }
}