Cleanup IDN tests
IDNSpoofCheckerTest.IDNToUnicodeThese takes a punycode hostname, passes it through url_formatter's IDN conversion logic and checks the output. If the hostname is safe, it expects the conversion result to be equal to the expected unicode value. Otherwise, it expects the result to be equal to the input punycode value. This means that the test doesn't actually use the expected unicode value if the conversion is not safe. As a result, a few invalid values have made it to the expected_unicode field of the tests. This CL adds a sanity check to make sure that the expected_unicode field is indeed the unicode version of the input hostname. It does this by first doing an unsafe conversion disabling the spoof checks. The CL also introduces an enum with an "invalid" result type. This result is used for punycode that fail before coming to the spoof checks. Making this distinction seems important to be able to reason about why some inputs are failing. Bug: 1036523 Change-Id: Id1d2c374e5cb01900f61703418c21512c41b445d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1979592 Commit-Queue: Mustafa Emre Acer <meacer@chromium.org> Reviewed-by:Joe DeBlasio <jdeblasio@chromium.org> Cr-Commit-Position: refs/heads/master@{#728352}
Showing
This diff is collapsed.
Please register or sign in to comment