xref: /aosp_15_r20/external/pdfium/testing/BUILD.gn (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1# Copyright 2018 The PDFium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/sanitizers/sanitizers.gni")
6import("//build_overrides/build.gni")
7import("../pdfium.gni")
8
9source_set("test_support") {
10  testonly = true
11  sources = [
12    "command_line_helpers.cpp",
13    "command_line_helpers.h",
14    "font_renamer.cpp",
15    "font_renamer.h",
16    "fx_string_testhelpers.cpp",
17    "fx_string_testhelpers.h",
18    "invalid_seekable_read_stream.cpp",
19    "invalid_seekable_read_stream.h",
20    "pseudo_retainable.h",
21    "scoped_set_tz.cpp",
22    "scoped_set_tz.h",
23    "string_write_stream.cpp",
24    "string_write_stream.h",
25    "test_fonts.cpp",
26    "test_fonts.h",
27    "test_loader.cpp",
28    "test_loader.h",
29    "test_support.h",
30    "utils/bitmap_saver.cpp",
31    "utils/bitmap_saver.h",
32    "utils/file_util.cpp",
33    "utils/file_util.h",
34    "utils/hash.cpp",
35    "utils/hash.h",
36  ]
37  data = [ "resources/" ]
38  public_deps = [
39    ":path_service",
40    "//third_party/test_fonts",
41  ]
42  deps = [
43    "../:pdfium_public_headers",
44    "../core/fdrm",
45    "../core/fxcrt",
46    "../core/fxge",
47    "image_diff",
48  ]
49  configs += [
50    "../:pdfium_strict_config",
51    "../:pdfium_noshorten_config",
52  ]
53  visibility = [ "../*" ]
54  if (pdf_use_partition_alloc) {
55    sources += [
56      "allocator_shim_config.cpp",
57      "allocator_shim_config.h",
58    ]
59    deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
60  }
61  if (pdf_enable_v8) {
62    sources += [
63      "v8_initializer.cpp",
64      "v8_initializer.h",
65    ]
66    deps += [
67      "//v8",
68      "//v8:v8_libplatform",
69    ]
70    configs += [ "//v8:external_startup_data" ]
71  }
72}
73
74source_set("path_service") {
75  testonly = true
76  sources = [
77    "utils/path_service.cpp",
78    "utils/path_service.h",
79  ]
80  deps = [ "../core/fxcrt" ]
81  configs += [
82    "../:pdfium_strict_config",
83    "../:pdfium_noshorten_config",
84  ]
85  visibility = [ "../*" ]
86}
87
88source_set("test_environments") {
89  testonly = true
90  sources = [
91    "pdf_test_environment.cpp",
92    "pdf_test_environment.h",
93  ]
94  deps = [
95    ":test_support",
96    "../core/fxcrt",
97    "../core/fxge",
98    "//testing/gtest",
99  ]
100  configs += [
101    "../:pdfium_strict_config",
102    "../:pdfium_noshorten_config",
103  ]
104  if (pdf_enable_v8) {
105    sources += [
106      "v8_test_environment.cpp",
107      "v8_test_environment.h",
108    ]
109    deps += [
110      "../fxjs",
111      "//v8",
112      "//v8:v8_libplatform",
113    ]
114    configs += [ "//v8:external_startup_data" ]
115  }
116  if (pdf_enable_xfa) {
117    sources += [
118      "xfa_test_environment.cpp",
119      "xfa_test_environment.h",
120    ]
121    deps += [
122      "../fxjs:gc",
123      "../xfa/fgas/font",
124    ]
125  }
126}
127
128source_set("unit_test_support") {
129  testonly = true
130  sources = []
131  deps = []
132  configs += [
133    "../:pdfium_strict_config",
134    "../:pdfium_noshorten_config",
135  ]
136  public_deps = [
137    ":test_environments",
138    ":test_support",
139  ]
140  if (pdf_enable_v8) {
141    sources += [
142      "fxv8_unittest.cpp",
143      "fxv8_unittest.h",
144    ]
145    deps += [
146      "../fxjs",
147      "//testing/gtest",
148    ]
149    configs += [ "//v8:external_startup_data" ]
150    if (pdf_enable_xfa) {
151      sources += [
152        "fxgc_unittest.cpp",
153        "fxgc_unittest.h",
154      ]
155      deps += [
156        "../fxjs:gc",
157        "//testing/gtest",
158      ]
159    }
160  }
161}
162
163source_set("embedder_test_support") {
164  testonly = true
165  sources = [
166    "embedder_test.cpp",
167    "embedder_test.h",
168    "embedder_test_constants.cpp",
169    "embedder_test_constants.h",
170    "embedder_test_environment.cpp",
171    "embedder_test_environment.h",
172    "embedder_test_mock_delegate.h",
173    "embedder_test_timer_handling_delegate.h",
174    "fake_file_access.cpp",
175    "fake_file_access.h",
176    "range_set.cpp",
177    "range_set.h",
178  ]
179  deps = [
180    "../:pdfium_public_headers",
181    "../core/fdrm",
182    "../core/fxge",
183    "../third_party:pdfium_base",
184    "//testing/gmock",
185    "//testing/gtest",
186  ]
187  public_deps = [
188    ":test_environments",
189    ":test_support",
190    "../core/fxcrt",
191  ]
192  configs += [
193    "../:pdfium_strict_config",
194    "../:pdfium_noshorten_config",
195  ]
196  visibility = [ "../*" ]
197  if (pdf_enable_v8) {
198    sources += [
199      "external_engine_embedder_test.cpp",
200      "external_engine_embedder_test.h",
201      "js_embedder_test.cpp",
202      "js_embedder_test.h",
203    ]
204    deps += [
205      "../fxjs",
206      "//v8",
207      "//v8:v8_libplatform",
208    ]
209    configs += [ "//v8:external_startup_data" ]
210    if (pdf_enable_xfa) {
211      sources += [
212        "xfa_js_embedder_test.cpp",
213        "xfa_js_embedder_test.h",
214      ]
215      deps += [
216        "../fpdfsdk",
217        "../fpdfsdk/fpdfxfa",
218        "../xfa/fxfa",
219        "../xfa/fxfa/parser",
220      ]
221    }
222  }
223}
224
225# Dummy group to keep satisfy references from //build.
226group("test_scripts_shared") {
227}
228