Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Issue 2660793002: Add transport security state generator tests. (Closed)

Created:
3 years, 10 months ago by martijnc
Modified:
3 years, 8 months ago
Reviewers:
lgarron, Ryan Sleevi
CC:
cbentzel+watch_chromium.org, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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

Patch Set 1 #

Patch Set 2 : export method for tests #

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

Messages

Total messages: 28 (25 generated)
martijnc
Apologies for the delay, I had hoped to get this done sooner. Although most changes ...
3 years, 10 months ago (2017-02-08 20:58:22 UTC) #24
Ryan Sleevi
Going to be very slow on reviews ,unfortunately, and this is a huge review. I ...
3 years, 10 months ago (2017-02-08 21:45:29 UTC) #25
martijnc
3 years, 10 months ago (2017-02-09 21:23:17 UTC) #28
On 2017/02/08 at 21:45:29, rsleevi wrote:
> Going to be very slow on reviews ,unfortunately, and this is a huge review.
> 
> I would definitely encourage you to break it into smaller reviews where
possible; I think it's useful to have this CL as you've done so we can see and
look back at "This is the overall direction we're going towards", but then see
if you can't break it into smaller sequential CLs that each do just enough to
make a consistent and holistic step forward, without being overwhelming.
> 
> Does that work?

Yes, I can probably split this up into 4 or 5 smaller CLs. I'll leave this one
up to provide an overview of the changes.

Powered by Google App Engine
This is Rietveld 408576698