| # Copyright 2019 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//chrome/test/base/js2gtest.gni") |
| import("//mojo/public/tools/bindings/mojom.gni") |
| import("//third_party/closure_compiler/compile_js.gni") |
| |
| assert(is_chromeos, "Media App is Chrome OS only") |
| |
| static_library("media_app_ui") { |
| sources = [ |
| "media_app_guest_ui.cc", |
| "media_app_guest_ui.h", |
| "media_app_page_handler.cc", |
| "media_app_page_handler.h", |
| "media_app_ui.cc", |
| "media_app_ui.h", |
| "media_app_ui_delegate.h", |
| "url_constants.cc", |
| "url_constants.h", |
| ] |
| |
| deps = [ |
| ":mojo_bindings", |
| ":mojo_bindings_js", |
| "//chromeos/components/web_applications", |
| "//chromeos/constants", |
| "//chromeos/resources:media_app_bundle_resources", |
| "//chromeos/resources:media_app_resources", |
| "//chromeos/strings", |
| "//content/public/browser", |
| "//mojo/public/cpp/bindings", |
| "//mojo/public/cpp/platform", |
| "//ui/webui", |
| ] |
| } |
| |
| js2gtest("browser_tests_js") { |
| test_type = "mojo_lite_webui" |
| |
| sources = [ "test/media_app_ui_browsertest.js" ] |
| |
| defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
| |
| deps = [ |
| ":browser_test_support", |
| "//chromeos/constants", |
| ] |
| } |
| |
| source_set("browser_test_support") { |
| testonly = true |
| sources = [ |
| "test/media_app_ui_browsertest.cc", |
| "test/media_app_ui_browsertest.h", |
| ] |
| |
| defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
| |
| deps = [ |
| ":media_app_ui", |
| "//chrome/test:test_support_ui", |
| "//chromeos/components/web_applications/test:test_support", |
| ] |
| |
| data = [ |
| "test/driver.js", |
| "test/driver_api.js", |
| "test/dom_testing_helpers.js", |
| "test/guest_query_receiver.js", |
| "test/media_app_guest_ui_browsertest.js", |
| ] |
| } |
| |
| group("closure_compile") { |
| testonly = true |
| deps = [ |
| ":closure_compile_tests", |
| "resources/js:closure_compile", |
| "resources/mock/js:closure_compile", |
| ] |
| } |
| |
| mojom("mojo_bindings") { |
| sources = [ "media_app_ui.mojom" ] |
| } |
| |
| # Note we compile with reportUnknownTypes while it works, but if dependencies |
| # get more complex, we should remove it and only enable in developer builds. |
| js_type_check("closure_compile_tests") { |
| testonly = true |
| closure_flags = default_closure_args + [ |
| "jscomp_error=strictCheckTypes", |
| "jscomp_error=reportUnknownTypes", |
| "language_in=ECMASCRIPT_2018", |
| |
| # TODO(crbug/1048973): Remove these when the mojo bindings |
| # js is updated to pass a closure compile check. |
| "hide_warnings_for=mojo/public/js/", |
| "hide_warnings_for=chromeos/components/media_app_ui/media_app_ui.mojom-lite-for-compile.js", |
| ] |
| deps = [ |
| ":test_driver_api_js", |
| ":test_driver_js", |
| ":test_guest_query_receiver_js", |
| ] |
| } |
| |
| js_library("test_driver_api_js") { |
| testonly = true |
| externs_list = [ "resources/js/web_app_file_handling.externs.js" ] |
| sources = [ "test/driver_api.js" ] |
| } |
| |
| js_library("test_dom_testing_helpers_js") { |
| testonly = true |
| sources = [ "test/dom_testing_helpers.js" ] |
| } |
| |
| js_library("test_guest_query_receiver_js") { |
| testonly = true |
| sources = [ "test/guest_query_receiver.js" ] |
| deps = [ |
| ":test_dom_testing_helpers_js", |
| ":test_driver_api_js", |
| "//chromeos/components/media_app_ui/resources/js:message_pipe", |
| "//chromeos/components/media_app_ui/resources/js:receiver", |
| ] |
| } |
| |
| js_library("test_driver_js") { |
| testonly = true |
| sources = [ "test/driver.js" ] |
| externs_list = [ "//third_party/chaijs/externs/chai-3.5.js" ] |
| deps = [ |
| ":test_driver_api_js", |
| "//chromeos/components/media_app_ui/resources/js:launch", |
| "//chromeos/components/media_app_ui/resources/js:message_pipe", |
| ] |
| } |