Skip to content

Commit 70b85a9

Browse files
ryanmeiera-maurice
authored andcommitted
Enable App OSS Tests (Desktop)
Moves most tests from app/src and app/rest/src to tests/ subfolders, and adds/updates CMakeLists.txt files to build the tests. Note that several tests in each are disabled initially due to nontrivial google3 dependencies that need to be removed. Bugs have been entered for tracking these: (b/138673663 for app/rest, b/138674328 for app). PiperOrigin-RevId: 260961554
1 parent 0baf0b0 commit 70b85a9

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed

app/rest/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,8 @@ else()
117117
-DCURL_MAX_WRITE_SIZE=65536
118118
)
119119
endif()
120+
121+
if(FIREBASE_CPP_BUILD_TESTS)
122+
# Add the tests subdirectory
123+
add_subdirectory(tests)
124+
endif()

app/rest/tests/CMakeLists.txt

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Copyright 2019 Google
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
include(binary_to_array)
16+
17+
set(FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS
18+
"--no-union-value-namespacing"
19+
"--gen-object-api"
20+
"--cpp-ptr-type" "flatbuffers::unique_ptr")
21+
build_flatbuffers("${CMAKE_CURRENT_LIST_DIR}/testdata/sample.fbs"
22+
""
23+
"app_rest_generated_includes"
24+
"${FIREBASE_FLATBUFFERS_DEPENDENCIES}"
25+
"${FIREBASE_GEN_FILE_DIR}/app/rest"
26+
""
27+
"")
28+
29+
binary_to_array("sample_resource"
30+
"${CMAKE_CURRENT_LIST_DIR}/testdata/sample.fbs"
31+
"firebase::rest"
32+
"${FIREBASE_GEN_FILE_DIR}/app/rest")
33+
34+
add_library(sample_resource_lib STATIC
35+
${sample_resource_source}
36+
${sample_resource_header}
37+
${FIREBASE_GEN_FILE_DIR}/app/rest/sample_generated.h
38+
)
39+
40+
target_include_directories(sample_resource_lib
41+
PUBLIC
42+
${FLATBUFFERS_SOURCE_DIR}/include
43+
)
44+
45+
cc_test(firebase_app_rest_request_test
46+
SOURCES
47+
request_test.h
48+
request_test.cc
49+
DEPENDS
50+
firebase_rest_lib
51+
)
52+
53+
cc_test(firebase_app_rest_request_binary_test
54+
SOURCES
55+
request_binary_test.cc
56+
DEPENDS
57+
firebase_rest_lib
58+
)
59+
60+
cc_test(firebase_app_rest_request_json_test
61+
SOURCES
62+
../request_json.h
63+
request_json_test.cc
64+
DEPENDS
65+
firebase_app
66+
firebase_rest_lib
67+
sample_resource_lib
68+
)
69+
70+
cc_test(firebase_app_rest_response_test
71+
SOURCES
72+
response_test.cc
73+
DEPENDS
74+
firebase_rest_lib
75+
)
76+
77+
cc_test(firebase_app_rest_response_binary_test
78+
SOURCES
79+
response_binary_test.cc
80+
DEPENDS
81+
firebase_rest_lib
82+
)
83+
84+
cc_test(firebase_app_rest_response_json_test
85+
SOURCES
86+
response_json_test.cc
87+
DEPENDS
88+
firebase_rest_lib
89+
sample_resource_lib
90+
)
91+
92+
cc_test(firebase_app_rest_util_test
93+
SOURCES
94+
util_test.cc
95+
DEPENDS
96+
firebase_rest_lib
97+
)
98+
99+
cc_test(firebase_app_rest_www_form_url_encoded_test
100+
SOURCES
101+
www_form_url_encoded_test.cc
102+
DEPENDS
103+
firebase_rest_lib
104+
)
105+
106+
cc_test(firebase_app_rest_transport_mock_test
107+
SOURCES
108+
transport_mock_test.cc
109+
../transport_mock.h
110+
../transport_mock.cc
111+
INCLUDES
112+
${FLATBUFFERS_SOURCE_DIR}/include
113+
DEPENDS
114+
firebase_app
115+
firebase_rest_lib
116+
firebase_testing
117+
)
118+
119+
#[[
120+
121+
# google3 Dependency: FLAGS_test_tmpdir, CHECK(), CHECK_EQ
122+
cc_test(firebase_app_rest_request_file_test
123+
SOURCES
124+
request_file_test.cc
125+
DEPENDS
126+
firebase_rest_lib
127+
)
128+
129+
# google3 Dependency: absl/strings/escaping (absl::CEscape)
130+
cc_test(firebase_app_rest_gzipheader_unittest
131+
SOURCES
132+
gzipheader_unittest.cc
133+
DEPENDS
134+
firebase_rest_lib
135+
)
136+
137+
# google3 Dependency: absl/strings/escaping (absl::CEscape)
138+
cc_test(firebase_app_rest_zlibwrapper_unittest
139+
SOURCES
140+
zlibwrapper_unittest.cc
141+
DEPENDS
142+
firebase_rest_lib
143+
)
144+
145+
# google3 Dependency: net/.../http2server, net/util/ports.h (net_util::PickUnusedPort())
146+
cc_test(firebase_app_rest_transport_curl_test
147+
SOURCES
148+
transport_curl_test.cc
149+
DEPENDS
150+
firebase_rest_lib
151+
)
152+
153+
]]

0 commit comments

Comments
 (0)