New issue
Advanced search Search tips

Issue 915193 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Use TestHostResolver to in unittest contexts to avoid network requests hitting the network

Project Member Reported by blundell@chromium.org, Dec 14

Issue description

I wondered the other day whether we have a mechanism in place to prevent network requests made in unittest contexts from actually hitting the network. Input from jam@:

"we try enforcing no network requests (e.g. outside the machien) in tests in browser tests, this is enforced by browser_test_base.cc instantiating a content::TestHostResolver

see the note in test_host_resolver.cc: https://cs.chromium.org/chromium/src/content/public/test/test_host_resolver.cc?rcl=cf2439b936f02d3c14518e1e00947f080d58c6d8&l=48
// To avoid depending on external resources and to reduce (if not preclude)
    // network interactions from tests, we simulate failure for non-local DNS
    // queries, rather than perform them.

if we don't have similar blocking in unit test binaries (which unfortunately we may not), it'd be good to add it."

We indeed don't, at least not via TestHostResolver; I added a DCHECK(0) to its constructor and verified that unit_tests still runs fine. It's possible of course that we do have such blocking via other means; I didn't dig deeper than that.
 
Status: Untriaged (was: Available)
Available, but no owner or component? Please find a component, as no one will ever find this without one.

Sign in to add a comment