Add NOTREACHED for InitiatorLockCompatibility::kNoLock + fix unit tests.
This CL adds a NOTREACHED assertion to the InitiatorLockCompatibility::kNoLock case in CorsURLLoaderFactory::IsValidRequest (in preparation for calling mojo::ReportBadMessage and returning false in a follow-up CL). Presence of the new NOTREACHED assertion requires fixing unit tests, so that they more accurately simulate the behavior of the product code. In particular: - A DCHECK has been added to CorsURLLoaderTest::ResetFactory to help ensure that all tests use a non-nullopt |request_initiator_site_lock| when simulating a renderer-side factory. - CorsURLLoaderTest::SetUp started passing non-null default initiator to CorsURLLoaderTest::ResetFactory. https://example.com was chosen as the default, because it is the most commonly used URL in other tests. This necessitated changing some tests to use the matching scheme (https rather than http). - Some tests were forced to specify a non-nullopt network::ResourceRequest::request_initiator (this is no longer okay, because if kNoLock case cannot be reached after this CL, then kNoInitiator case would crash the test). - Tests that really had to use a nullopt |request_initiator| were switched to simulating a browser-side factory (one with a nullopt |request_initiator_site_lock| and with kBrowserProcessId). Fixed: 1115222 Change-Id: I8c6e6603ba4626cf5c306ae5ca286fe1f1fb48e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350232 Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by:Takashi Toyoshima <toyoshim@chromium.org> Cr-Commit-Position: refs/heads/master@{#798890}
Showing
This diff is collapsed.
Please register or sign in to comment