This PR changes a few places where we used to have we had something like: ```cxx constexpr const char* kConstant[] = ... ``` These arrays array are not as safe as proper containers. There's also the challange that the strings referred by these arrays cannot have their sizes encoded on the type, so there's a certain reliance on `strlen` to determine the size. This change converts on of these arrays to `std::array`. The other array was converted to a `constexpr` flat set, as that is what this array was being used for. This flat set requires a custom comparator though, as the search of the elements as matching against `end_with`. With this change, the lookup will be a bit less wasteful. Resolves https://github.com/brave/brave-browser/issues/42484
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
# Copyright (c) 2022 The Brave Authors. All rights reserved.
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
import("//brave/components/tor/buildflags/buildflags.gni")
|
|
|
|
source_set("unit_tests") {
|
|
testonly = true
|
|
sources = [
|
|
"base/brave_host_port_pair_unittest.cc",
|
|
"decentralized_dns/constants_unittest.cc",
|
|
"http/partitioned_host_state_map_unittest.cc",
|
|
"http/transport_security_state_unittest.cc",
|
|
]
|
|
|
|
if (enable_tor) {
|
|
sources += [
|
|
"proxy_resolution/configured_proxy_resolution_service_unittest.cc",
|
|
"proxy_resolution/proxy_config_service_tor_unittest.cc",
|
|
]
|
|
}
|
|
|
|
deps = [
|
|
"//base",
|
|
"//base/test:test_support",
|
|
"//brave/net/base:unit_tests",
|
|
"//net",
|
|
"//net:test_support",
|
|
"//net/http:transport_security_state_unittest_data",
|
|
"//net/http:transport_security_state_unittest_data_default",
|
|
"//net/tools/huffman_trie:huffman_trie_generator_sources",
|
|
"//testing/gtest",
|
|
"//url",
|
|
]
|
|
}
|