# Copyright 2014 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("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")

group("common") {
  public_deps = [
    ":common_base",
    ":common_custom_types",
  ]
}

# GYP version: mojo/mojo_base.gyp:mojo_common_custom_types
mojom("common_custom_types") {
  sources = [
    "common_custom_types.mojom",
    "string16.mojom",
  ]
}

# GYP version: mojo/mojo_base.gyp:mojo_common_lib
component("common_base") {
  output_name = "mojo_common_lib"

  sources = [
    "common_type_converters.cc",
    "common_type_converters.h",
    "data_pipe_drainer.cc",
    "data_pipe_drainer.h",
    "data_pipe_file_utils.cc",
    "data_pipe_utils.cc",
    "data_pipe_utils.h",
    "user_agent.cc",
    "user_agent.h",
  ]

  defines = [ "MOJO_COMMON_IMPLEMENTATION" ]

  public_deps = [
    "//base",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/system",
  ]
}

# GYP version: mojo/mojo_base.gyp:mojo_test_common_custom_types
mojom("test_common_custom_types") {
  sources = [
    "test_common_custom_types.mojom",
  ]
  public_deps = [
    ":common_custom_types",
  ]
}

# GYP version: mojo/mojo_base.gyp:mojo_common_unittests
test("mojo_common_unittests") {
  deps = [
    ":common",
    ":common_custom_types",
    ":test_common_custom_types",
    "//base",
    "//base:message_loop_tests",
    "//base/test:test_support",
    "//mojo/edk/test:run_all_unittests",
    "//mojo/edk/test:test_support",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gtest",
    "//url",
  ]

  sources = [
    "common_custom_types_unittest.cc",
    "common_type_converters_unittest.cc",
  ]
}

test("mojo_common_perftests") {
  deps = [
    ":common",
    "//base",
    "//mojo/edk/test:run_all_perftests",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gtest",
  ]
}