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