|
Add transport security state generator tests.
This CL adds tests for the transport security state generator and refactors
parts of the existing code to make it testable.
Changes to existing code:
- The preloaded transport security state data source is made configurable for
the tests. It was previously hardcoded to the data in
transport_security_state_static.h
- The Pinset struct definition is moved to a separate file to make it reusable
between transport_security_state_static.h and the related unittests.
- The build configuration is moved to its own BUILD.gn file.
- The (trie) generation code was refactored to improve the handling of incorrect
inputs. The existing code would CHECK or DCHECK where the old go script
panic()'ed. This makes it hard to properly test this code. Most (D)CHECKs are
removed in favor of boolean return values. Any existing return values are
converted to out parameters.
- The code responsible for parsing the input files is moved to a separate file
(input_file_parsers.(h|cc)) and out of the anonymous namespace to make them
testable.
- The error handling of this code is also improved by replacing std::cerr
output with a vector. The vector will contain all errors that were
encountered during the parsing of the inputs files*.
Tests:
- This CL adds unittests for the transport security state generator.
These tests are run as part of the net_unittests target.
- On the Chromium side, unittests are added to test the decoding of the
generated data. The input data for these tests is generated during the build.
* This currently is always, at most, 1 error but the plan is to change that when
issues 677294 and 568378 are addressed.
BUG= 595493
Total comments: 9
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+2892 lines, -539 lines) |
Patch |
|
M |
net/BUILD.gn
|
View
|
1
|
4 chunks |
+7 lines, -33 lines |
0 comments
|
Download
|
|
M |
net/http/transport_security_state.h
|
View
|
1
|
2 chunks |
+17 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/http/transport_security_state.cc
|
View
|
1
|
6 chunks |
+50 lines, -7 lines |
0 comments
|
Download
|
|
M |
net/http/transport_security_state_static.h
|
View
|
1
|
2 chunks |
+3 lines, -7 lines |
1 comment
|
Download
|
|
A |
net/http/transport_security_state_static_unittest.pins
|
View
|
1
|
1 chunk |
+12 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/http/transport_security_state_static_unittest1.json
|
View
|
1
|
1 chunk |
+38 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/http/transport_security_state_static_unittest2.json
|
View
|
1
|
1 chunk |
+61 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/http/transport_security_state_static_unittest3.json
|
View
|
1
|
1 chunk |
+69 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/http/transport_security_state_structs.h
|
View
|
1
|
1 chunk |
+18 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/http/transport_security_state_unittest.cc
|
View
|
1
|
3 chunks |
+286 lines, -0 lines |
1 comment
|
Download
|
|
A |
net/tools/transport_security_state_generator/BUILD.gn
|
View
|
1
|
1 chunk |
+93 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/bit_writer.h
|
View
|
|
3 chunks |
+4 lines, -3 lines |
1 comment
|
Download
|
|
M |
net/tools/transport_security_state_generator/bit_writer.cc
|
View
|
|
1 chunk |
+1 line, -9 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/bit_writer_unittest.cc
|
View
|
1
|
1 chunk |
+151 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/cert_util_unittest.cc
|
View
|
1
|
1 chunk |
+225 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/huffman/huffman_builder.h
|
View
|
1
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/huffman/huffman_builder.cc
|
View
|
1
|
5 chunks |
+17 lines, -10 lines |
2 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/huffman/huffman_builder_unittest.cc
|
View
|
1
|
1 chunk |
+155 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/input_file_parsers.h
|
View
|
1
|
1 chunk |
+46 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/input_file_parsers.cc
|
View
|
1
|
1 chunk |
+401 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/input_file_parsers_unittest.cc
|
View
|
1
|
1 chunk |
+377 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/pinsets.h
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/preloaded_state_generator.h
|
View
|
1
|
1 chunk |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/preloaded_state_generator.cc
|
View
|
1
|
5 chunks |
+27 lines, -25 lines |
1 comment
|
Download
|
|
M |
net/tools/transport_security_state_generator/resources/transport_security_state_static.template
|
View
|
1
|
2 chunks |
+3 lines, -7 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/resources/transport_security_state_static_unittest.template
|
View
|
1
|
1 chunk |
+36 lines, -0 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/spki_hash_unittest.cc
|
View
|
1
|
1 chunk |
+60 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/transport_security_state_entry.cc
|
View
|
1
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/transport_security_state_generator.cc
|
View
|
1
|
6 chunks |
+22 lines, -387 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/trie/trie_bit_buffer.h
|
View
|
|
4 chunks |
+7 lines, -4 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc
|
View
|
|
1 chunk |
+5 lines, -2 lines |
0 comments
|
Download
|
|
A |
net/tools/transport_security_state_generator/trie/trie_bit_buffer_unittest.cc
|
View
|
1
|
1 chunk |
+212 lines, -0 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/trie/trie_writer.h
|
View
|
|
4 chunks |
+14 lines, -6 lines |
0 comments
|
Download
|
|
M |
net/tools/transport_security_state_generator/trie/trie_writer.cc
|
View
|
1
|
9 chunks |
+70 lines, -31 lines |
1 comment
|
Download
|
|
A |
net/tools/transport_security_state_generator/trie/trie_writer_unittest.cc
|
View
|
1
|
1 chunk |
+396 lines, -0 lines |
2 comments
|
Download
|
Total messages: 28 (25 generated)
|