1 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import("//build/config/features.gni") 6 import("//testing/test.gni") 7 import("//third_party/protobuf/proto_library.gni") 8 9 assert(use_dbus) 10 11 component("dbus") { 12 sources = [ 13 "bus.cc", 14 "bus.h", 15 "dbus_export.h", 16 "dbus_statistics.cc", 17 "dbus_statistics.h", 18 "exported_object.cc", 19 "exported_object.h", 20 "file_descriptor.cc", 21 "file_descriptor.h", 22 "message.cc", 23 "message.h", 24 "object_manager.cc", 25 "object_manager.h", 26 "object_path.cc", 27 "object_path.h", 28 "object_proxy.cc", 29 "object_proxy.h", 30 "property.cc", 31 "property.h", 32 "scoped_dbus_error.cc", 33 "scoped_dbus_error.h", 34 "string_util.cc", 35 "string_util.h", 36 "util.cc", 37 "util.h", 38 "values_util.cc", 39 "values_util.h", 40 ] 41 42 defines = [ "DBUS_IMPLEMENTATION" ] 43 44 deps = [ 45 "//third_party/protobuf:protobuf_lite", 46 ] 47 public_deps = [ 48 "//base", 49 ] 50 51 public_configs = [ "//build/config/linux/dbus" ] 52 } 53 54 proto_library("test_proto") { 55 sources = [ 56 "test_proto.proto", 57 ] 58 } 59 60 # This target contains mocks that can be used to write unit tests without 61 # issuing actual D-Bus calls. 62 static_library("test_support") { 63 testonly = true 64 sources = [ 65 "mock_bus.cc", 66 "mock_bus.h", 67 "mock_exported_object.cc", 68 "mock_exported_object.h", 69 "mock_object_manager.cc", 70 "mock_object_manager.h", 71 "mock_object_proxy.cc", 72 "mock_object_proxy.h", 73 ] 74 75 public_deps = [ 76 ":dbus", 77 ] 78 deps = [ 79 "//testing/gmock", 80 ] 81 82 configs += [ "//build/config/linux/dbus" ] 83 } 84 85 test("dbus_unittests") { 86 sources = [ 87 "bus_unittest.cc", 88 "dbus_statistics_unittest.cc", 89 "end_to_end_async_unittest.cc", 90 "end_to_end_sync_unittest.cc", 91 "message_unittest.cc", 92 "mock_unittest.cc", 93 "object_manager_unittest.cc", 94 "object_proxy_unittest.cc", 95 "property_unittest.cc", 96 "signal_sender_verification_unittest.cc", 97 "string_util_unittest.cc", 98 "test_service.cc", 99 "test_service.h", 100 "util_unittest.cc", 101 "values_util_unittest.cc", 102 ] 103 104 deps = [ 105 ":dbus", 106 ":test_proto", 107 ":test_support", 108 "//base/test:run_all_unittests", 109 "//base/test:test_support", 110 "//testing/gmock", 111 "//testing/gtest", 112 "//third_party/protobuf:protobuf_lite", 113 ] 114 115 configs += [ "//build/config/linux/dbus" ] 116 } 117 118 executable("dbus_test_server") { 119 testonly = true 120 sources = [ 121 "test_server.cc", 122 "test_service.cc", 123 "test_service.h", 124 ] 125 126 deps = [ 127 ":dbus", 128 "//base", 129 "//base/test:test_support", 130 "//build/config/sanitizers:deps", 131 ] 132 133 configs += [ "//build/config/linux/dbus" ] 134 } 135