chromium/ppapi/tests/extensions/BUILD.gn

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

import("//components/nacl/features.gni")
import("//components/nacl/target_cpu.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//ppapi/native_client/nacl_test_data.gni")

assert(enable_ppapi)

group("extensions") {
  newlib = "//build/toolchain/nacl:clang_newlib_${nacl_target_cpu}"
  pnacl = "//build/toolchain/nacl:newlib_pnacl"
  data_deps = [
    ":ppapi_tests_extensions_background_keepalive($newlib)",
    ":ppapi_tests_extensions_load_unload($newlib)",
    ":ppapi_tests_extensions_media_galleries($newlib)",
    ":ppapi_tests_extensions_multicast_permissions($newlib)",
    ":ppapi_tests_extensions_no_socket_permissions($newlib)",
    ":ppapi_tests_extensions_packaged_app($newlib)",
    ":ppapi_tests_extensions_packaged_app($pnacl)",
    ":ppapi_tests_extensions_popup($newlib)",
    ":ppapi_tests_extensions_socket_permissions($newlib)",
  ]
}

if (is_nacl) {
  nacl_test_data("ppapi_tests_extensions_background_keepalive") {
    sources = [ "background_keepalive/background.cc" ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/background_keepalive"
    test_files = [
      "background_keepalive/background.js",
      "background_keepalive/manifest.json",
    ]
  }

  nacl_test_data("ppapi_tests_extensions_load_unload") {
    sources = [ "load_unload/load_unload.cc" ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/load_unload"
    test_files = [
      "load_unload/background.js",
      "load_unload/ext_icon.png",
      "load_unload/manifest.json",
    ]
  }

  nacl_test_data("ppapi_tests_extensions_media_galleries") {
    sources = [
      "//ppapi/tests/test_utils.cc",
      "//ppapi/tests/test_utils.h",
      "media_galleries/test_galleries.cc",
    ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/media_galleries"
    test_files = [
      "media_galleries/background.js",
      "media_galleries/index.html",
      "media_galleries/manifest.json",
      "media_galleries/test.js",
    ]
  }

  nacl_test_data("ppapi_tests_extensions_multicast_permissions") {
    sources = [ "multicast_permissions/test_multicast_permissions.cc" ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/multicast_permissions"
    test_files = [
      "multicast_permissions/controller.js",
      "multicast_permissions/index.html",
      "multicast_permissions/main.js",
      "multicast_permissions/manifest.json",
    ]
  }

  nacl_test_data("ppapi_tests_extensions_no_socket_permissions") {
    sources = [ "no_socket_permissions/test_no_socket_permissions.cc" ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/no_socket_permissions"
    test_files = [
      "no_socket_permissions/controller.js",
      "no_socket_permissions/index.html",
      "no_socket_permissions/main.js",
      "no_socket_permissions/manifest.json",
    ]
  }

  nacl_test_data("ppapi_tests_extensions_popup") {
    sources = [ "popup/module.cc" ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/popup"
    test_files = [
      "popup/background.js",
      "popup/popup.html",
      "popup/popup.js",
      "popup/manifest.json",
    ]
  }

  nacl_test_data("ppapi_tests_extensions_socket_permissions") {
    sources = [ "socket_permissions/test_socket_permissions.cc" ]
    deps = [ "//ppapi/cpp" ]
    destination_dir = "test_data/ppapi/tests/extensions/socket_permissions"
    test_files = [
      "socket_permissions/controller.js",
      "socket_permissions/index.html",
      "socket_permissions/main.js",
      "socket_permissions/manifest.json",
    ]
  }
}

if (is_nacl) {
  nacl_test_data("ppapi_tests_extensions_packaged_app") {
    sources = [ "packaged_app/test_packaged_app.cc" ]
    deps = [ "//ppapi/cpp" ]

    # This is built with an old nacl toolchain, so it shouldn't pull in
    # any of chrome's "actual" code.
    assert_no_deps = [ "//base" ]

    destination_dir = "test_data/ppapi/tests/extensions/packaged_app"
    test_files = [
      "packaged_app/controller.js",
      "packaged_app/index.html",
      "packaged_app/main.js",
      "packaged_app/manifest.json",
      "packaged_app/test_file.txt",
      "packaged_app/test_file2.txt",
    ]
    nmfflags = [
      # Add 16 "files" entries to make sure that open_resource can handle
      # more files than IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage
      # which is currently 7 (also 16 is a large-but-reasonable number of
      # possible DSOs for an app to have)
      "-xtest_file0:test_file.txt",
      "-xtest_file1:test_file2.txt",
      "-xtest_file2:test_file.txt",
      "-xtest_file3:test_file2.txt",
      "-xtest_file4:test_file.txt",
      "-xtest_file5:test_file2.txt",
      "-xtest_file6:test_file.txt",
      "-xtest_file7:test_file2.txt",
      "-xtest_file8:test_file.txt",
      "-xtest_file9:test_file2.txt",
      "-xtest_file10:test_file.txt",
      "-xtest_file11:test_file2.txt",
      "-xtest_file12:test_file.txt",
      "-xtest_file13:test_file2.txt",
      "-xtest_file14:test_file.txt",
      "-xtest_file15:test_file2.txt",
      "-xtest_file16:test_file.txt",
    ]
  }
}