New issue
Advanced search Search tips

Issue 810329 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocking:
issue 598073



Sign in to add a comment

Fix DnsProbe browser tests that rely on delaying requests to work with the Network Service

Project Member Reported by blundell@chromium.org, Feb 8 2018

Issue description

These tests rely on DelayableURLRequestFailedJob delaying its response to requests (they obtain this behavior by invoking SetCorrectionServiceDelayRequests()). The URLLoaderInterceptor that is being used in the Network Service path does not change its behavior in any way as a result of invocations to SetCorrectionServiceDelayRequests(); presumably it needs to for these tests to pass. I don't know offhand how to mimic this behavior of DelayableURLRequestFailedJob in a URLLoaderInterceptor.

Note that of course there might be other blockers to these tests passing. 
 
Cc: jam@chromium.org rdsmith@chromium.org mmenke@chromium.org
Is there an obvious template for delaying a response to requests using URLLoaderInterceptor?
With the embedded test server, ControllableHttpResponse lets you delay responses.  I don't believe it would be too hard to do with URLLoaderInterceptor, either.  I'd tend to suggest using the embedded test server over URLLoaderInterceptor when reasonably doable, just because it avoids dependency on how the network stack is hooked up.

Comment 3 by jam@chromium.org, Feb 8 2018

+1 to always preferring ControllableHttpResponse over URLLoaderInterceptor. I'll add a comment to the latter that it should only be used as a last resort.
Thanks for the responses! In this case, the browsertests already have a URLLoaderInterceptor installed that does the work of handling the requests (both requests to read a file off disk and requests that should fail):

https://cs.chromium.org/chromium/src/chrome/browser/net/dns_probe_browsertest.cc?q=DNSProbeBr&sq=package:chromium&l=546

Naively, it seems to me that the most straightforward path would be to insert a conditional into that method that causes it to bail out when the request should be delayed and then execute the response later when directed. From my reading of URLLoaderInterceptor, this could be accomplished as follows:

- If the request should be delayed, InterceptURLLoaderRequest() inserts the params into a vector of delayed requests and respond true.
- When it is desired to respond to all delayed requests, a wrapper method could simply go through the vector and call InterceptURLLoaderRequest() again on each of them.
- The one subtlety here is that some of these requests are failed requests, but InterceptURLLoaderRequest() will already have responded true for them and hence won't get the default URLLoaderInterceptor handling of them. I would break out the code for handling them here: https://cs.chromium.org/chromium/src/content/public/test/url_loader_interceptor.cc?q=url_loader_interce&sq=package:chromium&l=61 into a public URLLoaderInterceptor helper method that could be called here.

Does that make sense, or does it still seem better to use ControllableHttpResponse in this case? Naively, the latter doesn't seem to fit naturally into the existing setup of the dns probe tests to me.
Project Member

Comment 5 by bugdroid1@chromium.org, Feb 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d207aa5a8f7ce716b908d2be778a3dbe4f43a072

commit d207aa5a8f7ce716b908d2be778a3dbe4f43a072
Author: Colin Blundell <blundell@chromium.org>
Date: Fri Feb 09 00:56:54 2018

Better categorize some DnsProbe browsertests Network Service failures

Discovered in the course of producing
https://chromium-review.googlesource.com/c/chromium/src/+/887065.

Bug:  810329 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Ibb57d149d5e69c09cb0c795a404d957d79bcce9f
Reviewed-on: https://chromium-review.googlesource.com/906733
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535600}
[modify] https://crrev.com/d207aa5a8f7ce716b908d2be778a3dbe4f43a072/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter

Cc: -rdsmith@chromium.org

Comment 7 by dxie@chromium.org, May 15 2018

Labels: -Pri-3 Proj-Servicification-Canary OS-All Pri-1
Owner: jam@chromium.org
Status: Assigned (was: Available)
jam@, please help triage/reassign.

Comment 8 by dxie@chromium.org, May 18 2018

Labels: -OS-All OS-Windows OS-Linux OS-Mac OS-Chrome OS-Android
Labels: -Pri-1 Pri-2
Dropping priority since this is a test-only issue
Labels: -Proj-Servicification-Canary Proj-Servicification
punting it off Canary list.
Labels: Hotlist-KnownIssue
Status: Fixed (was: Assigned)
BTW to follow-up on earlier comments, the DNS tests depended on sending net error codes, which can't be simulated when using the EmbeddedTestServer, so I used the URLLoaderInterceptor.

Sign in to add a comment