Fix DnsProbe browser tests that rely on delaying requests to work with the Network Service |
||||||||
Issue descriptionThese 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.
,
Feb 8 2018
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.
,
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.
,
Feb 8 2018
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.
,
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
,
Feb 16 2018
,
May 15 2018
jam@, please help triage/reassign.
,
May 18 2018
,
Jul 23
Dropping priority since this is a test-only issue
,
Aug 27
punting it off Canary list.
,
Aug 27
,
Jan 4
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8e0417b1f432b5f42c7c43ec938946fc62e49660 commit 8e0417b1f432b5f42c7c43ec938946fc62e49660 Author: John Abd-El-Malek <jam@chromium.org> Date: Fri Jan 04 21:44:07 2019 Convert remaining DnsProbeBrowserTests to work with network service. These depended on delaying responses. Also simplify DNSErrorPageTest a bit. Bug: 810329 Change-Id: Id8192455ce0f2bdbce16509695808cf6229cbd87 Reviewed-on: https://chromium-review.googlesource.com/c/1395145 Commit-Queue: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Doug Turner <dougt@chromium.org> Cr-Commit-Position: refs/heads/master@{#620072} [modify] https://crrev.com/8e0417b1f432b5f42c7c43ec938946fc62e49660/chrome/browser/net/dns_probe_browsertest.cc [modify] https://crrev.com/8e0417b1f432b5f42c7c43ec938946fc62e49660/chrome/browser/net/errorpage_browsertest.cc [modify] https://crrev.com/8e0417b1f432b5f42c7c43ec938946fc62e49660/chrome/browser/net/url_request_mock_util.cc [modify] https://crrev.com/8e0417b1f432b5f42c7c43ec938946fc62e49660/chrome/browser/net/url_request_mock_util.h [modify] https://crrev.com/8e0417b1f432b5f42c7c43ec938946fc62e49660/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
,
Jan 4
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 |
||||||||
Comment 1 by blundell@chromium.org
, Feb 8 2018